1
0
mirror of synced 2024-11-22 13:26:06 +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 () { mounted () {
this.hydrate(this.mergedInitial) this.hydrate(this.mergedInitial)
// this.$emit('mounted', true)
}, },
methods: { methods: {
registerField (field, data) { registerField (field, data) {
this.$store.commit(`${this.m}setFieldMeta`, {form: this.name, field, data}) this.$store.commit(`${this.m}setFieldMeta`, {form: this.name, field, data})
if (this.mergedInitial.hasOwnProperty(field)) { this.$store.commit(`${this.m}setFieldValue`, {
this.$store.commit(`${this.m}setFieldValue`, { field,
field, value: this.mergedInitial.hasOwnProperty(field) ? this.mergedInitial[field] : undefined,
value: this.mergedInitial[field], form: this.name
form: this.name })
})
}
// this.updateFormValidation()
}, },
deregisterField (field) { deregisterField (field) {
this.$store.commit(`${this.m}removeField`, { this.$store.commit(`${this.m}removeField`, {
@ -129,7 +125,6 @@ export default {
}) })
} }
} }
// this.updateFormValidation()
}, },
setInitial (field, value) { setInitial (field, value) {
this.fieldInitials = Object.assign({}, this.fieldInitials, {[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, { this.$store.commit(`${this.m}setFieldValue`, Object.assign(change, {
form: this.name form: this.name
})) }))
// this.updateFormValidation()
}, },
updateFieldErrors (change) { updateFieldErrors (change) {
this.$store.commit(`${this.m}setFieldErrors`, Object.assign(change, { this.$store.commit(`${this.m}setFieldErrors`, Object.assign(change, {