This commit is contained in:
2019-11-21 01:03:27 +00:00
parent b2f48cd45a
commit 1f34ec6256
4 changed files with 33 additions and 4 deletions

View File

@@ -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.

View File

@@ -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);

View File

@@ -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
></v-textarea>
<!-- <v-textarea
v-model="obj.notes"
:readonly="this.formState.readOnly"
:label="lt('WidgetNotes')"
:error-messages="form().serverErrors(this, 'notes')"
ref="notes"
@change="onChange('notes')"
auto-grow
></v-textarea> -->
</div>
<div v-else-if="item.type === 'number'">
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;

View File

@@ -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";