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 +
", 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);
}
};

View File

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

View File

@@ -2,19 +2,7 @@
<v-layout v-if="this.formReady">
<v-flex>
<v-form ref="form">
<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-layout align-center justify-left row wrap>
<v-flex xs12 mt-1 mb-2>
<v-alert
ref="errorbox"
@@ -35,7 +23,7 @@
:rules="[this.$gzv.Max255(this,'name')]"
:error-messages="this.$gzv.ServerErrors(this,'name')"
ref="name"
@change="test('name')"
@change="Change('name')"
></v-text-field>
</v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2>
@@ -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')"
></v-text-field>
</v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2>
@@ -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')"
></v-text-field>
</v-flex>
@@ -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')"
></v-text-field>
</v-flex>
@@ -81,7 +69,7 @@
v-model="obj.startDate"
ref="startDate"
:error-messages="this.$gzv.ServerErrors(this,'startDate')"
@change="test('startDate')"
@change="Change('startDate')"
></gz-date-time-picker>
</v-flex>
@@ -92,7 +80,7 @@
:error-messages="this.$gzv.ServerErrors(this,'endDate')"
v-model="obj.endDate"
ref="endDate"
@change="test('endDate')"
@change="Change('endDate')"
></gz-date-time-picker>
</v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2>
@@ -102,7 +90,7 @@
ref="active"
:error-messages="this.$gzv.ServerErrors(this,'active')"
required
@change="test('active')"
@change="Change('active')"
></v-checkbox>
</v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2>
@@ -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')"
></v-text-field>
</v-flex>
</v-layout>
@@ -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;