From 4de7ed8a88ed84fef7a6e7c1bf0c1a2cec5c3114 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 3 Apr 2019 23:13:16 +0000 Subject: [PATCH] --- ayanova/src/api/gzvalidate.js | 21 ++++++----- .../src/components/gzdateandtimepicker.vue | 4 +-- ayanova/src/views/inventory-widget-edit.vue | 35 +++++++------------ 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/ayanova/src/api/gzvalidate.js b/ayanova/src/api/gzvalidate.js index b61e3cca..a6b727a0 100644 --- a/ayanova/src/api/gzvalidate.js +++ b/ayanova/src/api/gzvalidate.js @@ -105,17 +105,12 @@ function logControl(caller, ctrl, ref) { ctrl.lazyValue + ", initialValue=" + ctrl.initialValue + - ", loading=" + ctrl.loading + - ", isDirty=" + ctrl.isDirty + - ", isResetting=" + ctrl.isResetting + - - ", HAS CHANGED =" + hasChanged; @@ -362,10 +357,6 @@ export default { return ret; } - } else { - if (v.$gzdevmode()) { - throw "DEV ERROR gzvalidate::ServerErrors -> on field validation error no 'details' key was found to show which field had the error"; - } } } @@ -476,5 +467,17 @@ Here are all the API level error codes that can be returned by the API server: // console.log("gzvalidate::ErrorBoxErrors - RETURN WITH ERRORS"); return ret; + }, + /////////////////////////////// + // On Change handler + // This is required so that server errors can be cleared when input is changed + Change(v, ref) { + //If ref appears in the servererrors details collection, remove each one + var m = v.$_.remove(v.serverError.details, function(o) { + return o.target == ref; + }); + + console.log("Removed:"); + console.log(m); } }; diff --git a/ayanova/src/components/gzdateandtimepicker.vue b/ayanova/src/components/gzdateandtimepicker.vue index 96b2f386..ff689f60 100644 --- a/ayanova/src/components/gzdateandtimepicker.vue +++ b/ayanova/src/components/gzdateandtimepicker.vue @@ -78,8 +78,8 @@ export default { }, watch: { date() { - //this tortuous fuckery is required so that the input and change events only fire on a real change, not setup - + //this tortuous fuckery is required so that the input and change events only fire on a real change, not initial page load + //also it shouldn't signal a change if the values are the same and nothing was effectively changed var hasChanged = false; if (this.oldDate != null && this.date != this.oldDate) { hasChanged = true; diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 75e7c5a1..e058fc9b 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -2,19 +2,7 @@ - - + @@ -46,7 +34,7 @@ :rules="[this.$gzv.MaxLength(this,'serial',10)]" :error-messages="this.$gzv.ServerErrors(this,'count')" ref="serial" - @change="test('serial')" + @change="Change('serial')" > @@ -58,7 +46,7 @@ :rules="[this.$gzv.Integer(this,'count'),this.$gzv.Required(this,'count')]" :error-messages="this.$gzv.ServerErrors(this,'count')" required - @change="test('count')" + @change="Change('count')" > @@ -71,7 +59,7 @@ required :rules="[this.$gzv.Decimal(this,'dollarAmount'),this.$gzv.Required(this,'dollarAmount')]" :error-messages="this.$gzv.ServerErrors(this,'dollarAmount')" - @change="test('dollarAmount')" + @change="Change('dollarAmount')" > @@ -81,7 +69,7 @@ v-model="obj.startDate" ref="startDate" :error-messages="this.$gzv.ServerErrors(this,'startDate')" - @change="test('startDate')" + @change="Change('startDate')" > @@ -92,7 +80,7 @@ :error-messages="this.$gzv.ServerErrors(this,'endDate')" v-model="obj.endDate" ref="endDate" - @change="test('endDate')" + @change="Change('endDate')" > @@ -102,7 +90,7 @@ ref="active" :error-messages="this.$gzv.ServerErrors(this,'active')" required - @change="test('active')" + @change="Change('active')" > @@ -113,7 +101,7 @@ :rules="[this.$gzv.Integer(this,'roles'),this.$gzv.Required(this,'roles')]" :error-messages="this.$gzv.ServerErrors(this,'roles')" required - @change="test('roles')" + @change="Change('roles')" > @@ -189,9 +177,10 @@ export default { }; }, methods: { - test(ref){ + Change(ref){ //debugger; - console.log("CHANGE - " + ref); + //console.log("CHANGE - " + ref); + this.$gzv.Change(this,ref); } , getDataFromApi() { var url = "Widget/" + this.$route.params.id;