From e8dcddfa65173e9c31ff9cb2fe07a13b983cfb4a Mon Sep 17 00:00:00 2001 From: Andrew Croce Date: Wed, 3 Oct 2018 09:58:02 -0400 Subject: [PATCH] Add submit handler that prevents normal submission if `readyToSubmit` flag is not set --- js/components/forms/new_project.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/components/forms/new_project.js b/js/components/forms/new_project.js index aaa555d5..21cdf01a 100644 --- a/js/components/forms/new_project.js +++ b/js/components/forms/new_project.js @@ -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