Verify that the modal form is only concerned with its own fields
This commit is contained in:
parent
85b6287e0c
commit
39975a0a31
@ -27,6 +27,7 @@ export default {
|
|||||||
step: 0,
|
step: 0,
|
||||||
fields: {},
|
fields: {},
|
||||||
invalid: true,
|
invalid: true,
|
||||||
|
parent_uid: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -51,9 +52,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleValidChange: function(event) {
|
handleValidChange: function(event) {
|
||||||
const { name, valid } = event
|
const { name, valid, parent_uid } = event
|
||||||
this.fields[name] = valid
|
// check that this field is in the modal and not on some other form
|
||||||
this._checkIsValid()
|
if (parent_uid === this.parent_uid) {
|
||||||
|
this.fields[name] = valid
|
||||||
|
this._checkIsValid()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_checkIsValid: function() {
|
_checkIsValid: function() {
|
||||||
const valid = !Object.values(this.fields).some(field => field === false)
|
const valid = !Object.values(this.fields).some(field => field === false)
|
||||||
@ -61,8 +65,9 @@ export default {
|
|||||||
return valid
|
return valid
|
||||||
},
|
},
|
||||||
handleFieldMount: function(event) {
|
handleFieldMount: function(event) {
|
||||||
const { name, optional } = event
|
const { name, optional, parent_uid } = event
|
||||||
this.fields[name] = optional
|
this.fields[name] = optional
|
||||||
|
this.parent_uid = parent_uid
|
||||||
},
|
},
|
||||||
handleModalOpen: function(_bool) {
|
handleModalOpen: function(_bool) {
|
||||||
this.step = 0
|
this.step = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user