diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 23dacef2..62f26e0c 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -49,6 +49,13 @@ CURRENT TODOs TODO: Widget edit form, new record gives following error because custom field not set that is required: - {"error":{"code":"2200","details":[{"target":"WidgetCustom2","error":"2204"}],"message":"Object did not pass validation"}} - Why is this not displaying right in the UI error box? It just says "Validation error Object did not pass validation" and nothing else!? + - Ok, this is a bigger issue than originally seen. + - The server returns as above a normal error json fragment, the custom fields are referenced by their names like any other fields + - However, in the edit form each control has a ref and errors collection set by that ref so essentially it's sending "customFields" as the ref name of the entire custom fields control to the error returning code, however there are not matching fields + - i.e. the error comes back as for field named "WidgetCustom2" but the form is looking for errors for "customFields" + - What should happen: + - Custom fields control should participate in the same error code as the main form so it's identical and works + - Maybe can just do it like the main form but reference the main form's error collection?? TODO: Make sure can easily make new record in Widget form before getting into deeper stuff or making any other object forms. diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index 4b13978c..e36ef5ad 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -1,4 +1,4 @@ -/* Xeslint-disable */ +/* eslint-disable */ /////////////////////////////// // gzform // @@ -319,10 +319,14 @@ export default { // Process and return server errors if any for form and field specified // serverErrors(vm, ref) { + //CHECK PREREQUISITES IN DEV MODE TO ENSURE FORM ISN"T MISSING NEEDED DATA ATTRIBUTES ETC if (window.$gz.errorHandler.devMode()) { + //make sure formState.serverErrors is defined on data if (!window.$gz._.has(vm, "formState.serverError")) { + debugger; + throw "DEV ERROR gzform::formState.serverErrors -> formState.serverError seems to be missing from form's vue data object"; } @@ -348,7 +352,7 @@ export default { //check for errors if we have any errors if (!window.$gz._.isEmpty(vm.formState.serverError)) { - //debugger; + debugger; //First let's get the top level error code var apiErrorCode = parseInt(vm.formState.serverError.code); diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue index 5818d4de..438d84c1 100644 --- a/ayanova/src/components/custom-fields-control.vue +++ b/ayanova/src/components/custom-fields-control.vue @@ -42,8 +42,20 @@ v-model="_self[item.dataKey]" :readonly="readOnly" :label="lt(item.fld)" + :ref="item.fld" + :error-messages="form().serverErrors(parentVM, item.fld)" auto-grow > + +
NUMBER INPUT CONTROL HERE @@ -122,7 +134,8 @@ export default { props: { value: String, formKey: String, //used to grab template from store - readOnly: Boolean + readOnly: Boolean, + parentVM: Object }, computed: { c2: { @@ -138,6 +151,10 @@ export default { lt: function(ltkey) { return window.$gz.locale.get(ltkey); }, + form() { + //nothing + return window.$gz.form; + }, GetValueForField: function(dataKey) { if (!this.value) { return null; diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index dc72ede7..7a82aa5a 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -165,6 +165,7 @@ :formKey="formCustomTemplateKey" v-bind:value.sync="obj.customFields" :readOnly="this.formState.readOnly" + :parentVM="this" ref="customFields" :error-messages="form().serverErrors(this, 'customFields')" @change="onChange('customFields')" @@ -199,7 +200,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Xeslint-disable */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// - +//Illegal1 = O0 const FORM_KEY = "inventory-widget-edit"; const FORM_BASE_URL = "Widget/"; const FORM_CUSTOM_TEMPLATE_KEY = "widget";