Add submit handler that prevents normal submission if readyToSubmit flag is not set

This commit is contained in:
Andrew Croce 2018-10-03 09:58:02 -04:00
parent b6b03e73bc
commit e8dcddfa65

View File

@ -85,6 +85,13 @@ export default {
return names.every((n, index) => names.indexOf(n) === index)
},
handleSubmit: function (modalName, event) {
if (!this.readyToSubmit) {
event.preventDefault()
this.validateAndOpenModal(modalName)
}
},
validateAndOpenModal: function (modalName) {
let isValid = this.$children.reduce((previous, newVal) => {
// display textInput error if it is not valid