This commit is contained in:
2019-04-03 23:13:16 +00:00
parent c450006448
commit 4de7ed8a88
3 changed files with 26 additions and 34 deletions

View File

@@ -105,17 +105,12 @@ function logControl(caller, ctrl, ref) {
ctrl.lazyValue + ctrl.lazyValue +
", initialValue=" + ", initialValue=" +
ctrl.initialValue + ctrl.initialValue +
", loading=" + ", loading=" +
ctrl.loading + ctrl.loading +
", isDirty=" + ", isDirty=" +
ctrl.isDirty + ctrl.isDirty +
", isResetting=" + ", isResetting=" +
ctrl.isResetting + ctrl.isResetting +
", HAS CHANGED =" + ", HAS CHANGED =" +
hasChanged; hasChanged;
@@ -362,10 +357,6 @@ export default {
return ret; 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"); // console.log("gzvalidate::ErrorBoxErrors - RETURN WITH ERRORS");
return ret; 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);
} }
}; };

View File

@@ -78,8 +78,8 @@ export default {
}, },
watch: { watch: {
date() { 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; var hasChanged = false;
if (this.oldDate != null && this.date != this.oldDate) { if (this.oldDate != null && this.date != this.oldDate) {
hasChanged = true; hasChanged = true;

View File

@@ -2,19 +2,7 @@
<v-layout v-if="this.formReady"> <v-layout v-if="this.formReady">
<v-flex> <v-flex>
<v-form ref="form"> <v-form ref="form">
<v-layout align-center justify-left row wrap> <v-layout align-center justify-left row wrap>
<!-- <v-flex xs12 mt-1 mb-2>
<v-alert
color="warning"
icon="fa-exclamation-circle "
value="true"
transition="scale-transition"
outline
class="multi-line"
>
{{someerror}}
</v-alert>
</v-flex>-->
<v-flex xs12 mt-1 mb-2> <v-flex xs12 mt-1 mb-2>
<v-alert <v-alert
ref="errorbox" ref="errorbox"
@@ -35,7 +23,7 @@
:rules="[this.$gzv.Max255(this,'name')]" :rules="[this.$gzv.Max255(this,'name')]"
:error-messages="this.$gzv.ServerErrors(this,'name')" :error-messages="this.$gzv.ServerErrors(this,'name')"
ref="name" ref="name"
@change="test('name')" @change="Change('name')"
></v-text-field> ></v-text-field>
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
@@ -46,7 +34,7 @@
:rules="[this.$gzv.MaxLength(this,'serial',10)]" :rules="[this.$gzv.MaxLength(this,'serial',10)]"
:error-messages="this.$gzv.ServerErrors(this,'count')" :error-messages="this.$gzv.ServerErrors(this,'count')"
ref="serial" ref="serial"
@change="test('serial')" @change="Change('serial')"
></v-text-field> ></v-text-field>
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
@@ -58,7 +46,7 @@
:rules="[this.$gzv.Integer(this,'count'),this.$gzv.Required(this,'count')]" :rules="[this.$gzv.Integer(this,'count'),this.$gzv.Required(this,'count')]"
:error-messages="this.$gzv.ServerErrors(this,'count')" :error-messages="this.$gzv.ServerErrors(this,'count')"
required required
@change="test('count')" @change="Change('count')"
></v-text-field> ></v-text-field>
</v-flex> </v-flex>
@@ -71,7 +59,7 @@
required required
:rules="[this.$gzv.Decimal(this,'dollarAmount'),this.$gzv.Required(this,'dollarAmount')]" :rules="[this.$gzv.Decimal(this,'dollarAmount'),this.$gzv.Required(this,'dollarAmount')]"
:error-messages="this.$gzv.ServerErrors(this,'dollarAmount')" :error-messages="this.$gzv.ServerErrors(this,'dollarAmount')"
@change="test('dollarAmount')" @change="Change('dollarAmount')"
></v-text-field> ></v-text-field>
</v-flex> </v-flex>
@@ -81,7 +69,7 @@
v-model="obj.startDate" v-model="obj.startDate"
ref="startDate" ref="startDate"
:error-messages="this.$gzv.ServerErrors(this,'startDate')" :error-messages="this.$gzv.ServerErrors(this,'startDate')"
@change="test('startDate')" @change="Change('startDate')"
></gz-date-time-picker> ></gz-date-time-picker>
</v-flex> </v-flex>
@@ -92,7 +80,7 @@
:error-messages="this.$gzv.ServerErrors(this,'endDate')" :error-messages="this.$gzv.ServerErrors(this,'endDate')"
v-model="obj.endDate" v-model="obj.endDate"
ref="endDate" ref="endDate"
@change="test('endDate')" @change="Change('endDate')"
></gz-date-time-picker> ></gz-date-time-picker>
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
@@ -102,7 +90,7 @@
ref="active" ref="active"
:error-messages="this.$gzv.ServerErrors(this,'active')" :error-messages="this.$gzv.ServerErrors(this,'active')"
required required
@change="test('active')" @change="Change('active')"
></v-checkbox> ></v-checkbox>
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
@@ -113,7 +101,7 @@
:rules="[this.$gzv.Integer(this,'roles'),this.$gzv.Required(this,'roles')]" :rules="[this.$gzv.Integer(this,'roles'),this.$gzv.Required(this,'roles')]"
:error-messages="this.$gzv.ServerErrors(this,'roles')" :error-messages="this.$gzv.ServerErrors(this,'roles')"
required required
@change="test('roles')" @change="Change('roles')"
></v-text-field> ></v-text-field>
</v-flex> </v-flex>
</v-layout> </v-layout>
@@ -189,9 +177,10 @@ export default {
}; };
}, },
methods: { methods: {
test(ref){ Change(ref){
//debugger; //debugger;
console.log("CHANGE - " + ref); //console.log("CHANGE - " + ref);
this.$gzv.Change(this,ref);
} , } ,
getDataFromApi() { getDataFromApi() {
var url = "Widget/" + this.$route.params.id; var url = "Widget/" + this.$route.params.id;