From 3d76b4f1e3fd16a590c3c4c34ccc3f4856ddc818 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Wed, 21 Jun 2017 18:26:23 +0100 Subject: [PATCH 1/2] Change submission logic for regular form posts --- src/components/form-component.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/form-component.js b/src/components/form-component.js index e0d1a0cdf..54b0d5fd9 100644 --- a/src/components/form-component.js +++ b/src/components/form-component.js @@ -348,6 +348,9 @@ function createFormClass(s = defaultStrategy) { const formValid = formValue ? formValue.$form.valid : true; + + // prevent default form actions if the form is invalid. + if (e && this.props.action && !formValid) e.preventDefault(); if (!validators && onSubmit && formValid) { onSubmit(modelValue, e); From a30d0a2791a6400fa5953f8651c335295ae25ef0 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Wed, 21 Jun 2017 21:33:02 +0100 Subject: [PATCH 2/2] Lint fix --- src/components/form-component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/form-component.js b/src/components/form-component.js index 54b0d5fd9..e4607d030 100644 --- a/src/components/form-component.js +++ b/src/components/form-component.js @@ -348,7 +348,7 @@ function createFormClass(s = defaultStrategy) { const formValid = formValue ? formValue.$form.valid : true; - + // prevent default form actions if the form is invalid. if (e && this.props.action && !formValid) e.preventDefault();