1
0
mirror of synced 2024-11-25 23:06:02 +03:00

Field's without initial values commit undefined values, this fixes failing validation

This commit is contained in:
Justin Schroeder 2018-10-30 11:14:07 -04:00
parent 6391a14f0e
commit b0de7b5ee7
2 changed files with 6 additions and 12 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -99,19 +99,15 @@ export default {
},
mounted () {
this.hydrate(this.mergedInitial)
// this.$emit('mounted', true)
},
methods: {
registerField (field, data) {
this.$store.commit(`${this.m}setFieldMeta`, {form: this.name, field, data})
if (this.mergedInitial.hasOwnProperty(field)) {
this.$store.commit(`${this.m}setFieldValue`, {
field,
value: this.mergedInitial[field],
form: this.name
})
}
// this.updateFormValidation()
this.$store.commit(`${this.m}setFieldValue`, {
field,
value: this.mergedInitial.hasOwnProperty(field) ? this.mergedInitial[field] : undefined,
form: this.name
})
},
deregisterField (field) {
this.$store.commit(`${this.m}removeField`, {
@ -129,7 +125,6 @@ export default {
})
}
}
// this.updateFormValidation()
},
setInitial (field, value) {
this.fieldInitials = Object.assign({}, this.fieldInitials, {[field]: value})
@ -138,7 +133,6 @@ export default {
this.$store.commit(`${this.m}setFieldValue`, Object.assign(change, {
form: this.name
}))
// this.updateFormValidation()
},
updateFieldErrors (change) {
this.$store.commit(`${this.m}setFieldErrors`, Object.assign(change, {