This commit is contained in:
2019-04-22 23:24:33 +00:00
parent 58930cfab5
commit 26d8ffa7de
2 changed files with 37 additions and 3 deletions

View File

@@ -362,6 +362,7 @@ export default {
vm.appError = null; vm.appError = null;
//clear out actual message box display //clear out actual message box display
vm.errorBoxMessage = null; vm.errorBoxMessage = null;
vm.formValid = true;
}, },
/////////////////////////////// ///////////////////////////////
// setErrorBoxErrors // setErrorBoxErrors
@@ -407,5 +408,7 @@ export default {
vm.obj[ref] = val; vm.obj[ref] = val;
triggeringChange = false; triggeringChange = false;
} }
vm.formDirty = true;
vm.formValid = vm.$refs.form.validate();
} }
}; };

View File

@@ -19,6 +19,7 @@
<v-text-field <v-text-field
v-model="obj.name" v-model="obj.name"
clearable clearable
@click:clear="onChange('name')"
:counter="255" :counter="255"
:label="this.$gzlocale.get('WidgetName')" :label="this.$gzlocale.get('WidgetName')"
:rules="[this.$gzv.max255(this,'name'),this.$gzv.required(this,'name')]" :rules="[this.$gzv.max255(this,'name'),this.$gzv.required(this,'name')]"
@@ -31,6 +32,7 @@
<v-text-field <v-text-field
v-model="obj.serial" v-model="obj.serial"
clearable clearable
@click:clear="onChange('serial')"
:counter="10" :counter="10"
:label="this.$gzlocale.get('WidgetSerial')" :label="this.$gzlocale.get('WidgetSerial')"
:rules="[this.$gzv.maxLength(this,'serial',10)]" :rules="[this.$gzv.maxLength(this,'serial',10)]"
@@ -43,6 +45,7 @@
<v-text-field <v-text-field
v-model="obj.count" v-model="obj.count"
clearable clearable
@click:clear="onChange('count')"
:counter="10" :counter="10"
:label="this.$gzlocale.get('WidgetCount')" :label="this.$gzlocale.get('WidgetCount')"
ref="count" ref="count"
@@ -95,7 +98,7 @@
ref="active" ref="active"
:error-messages="this.$gzv.serverErrors(this,'active')" :error-messages="this.$gzv.serverErrors(this,'active')"
required required
@change="onChange('active')" @change="onChange('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>
@@ -112,6 +115,18 @@
</v-flex> </v-flex>
</v-layout> </v-layout>
<v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4>
READY: {{formReady}}
<br>
DIRTY: {{formDirty}}
<br>
VALID: {{formValid}}
<br>
READONLY: {{formReadOnly}}
<br>
</v-flex>
</v-layout>
<!-- <v-layout align-left justify-center row wrap mt-5> <!-- <v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4> <v-flex xs6 sm4>
<v-btn small @click="remove">{{ this.$gzlocale.get("Delete")}}</v-btn> <v-btn small @click="remove">{{ this.$gzlocale.get("Delete")}}</v-btn>
@@ -129,7 +144,7 @@
</template> </template>
<script> <script>
/* xeslint-disable */ /* eslint-disable */
function clickHandler(menuItem) { function clickHandler(menuItem) {
if (!menuItem) { if (!menuItem) {
return; return;
@@ -236,11 +251,24 @@ export default {
serverError: {}, serverError: {},
errorBoxMessage: null, errorBoxMessage: null,
appError: null, appError: null,
formReady: false formReady: false,
formDirty: false,
formValid: true,
formReadOnly: false
}; };
}, },
// watch: {
// obj: {
// handler: function(newObj, oldObj) {
// console.log("WATCH OBJ CHANGED ");
// },
// deep: true
// }
// },
methods: { methods: {
onChange(ref) { onChange(ref) {
console.log("onChange:" + ref);
this.$gzv.onChange(this, ref); this.$gzv.onChange(this, ref);
}, },
getDataFromApi() { getDataFromApi() {
@@ -277,6 +305,9 @@ export default {
vm.serverError = res.error; vm.serverError = res.error;
vm.$gzv.setErrorBoxErrors(vm); vm.$gzv.setErrorBoxErrors(vm);
} else { } else {
//It's ok, form is saved
vm.formDirty = false;
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put //Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
if (res.id) { if (res.id) {
//Handle "post" of new record //Handle "post" of new record