Multiple different form on same page and submitting one form after another one triggers validation for first submitted form
I have two different form form1 and form2 on same page, both have fields that require validation.
Here are my steps:
The page where two forms are placed is loaded
I have filled form 1 and submitted the form.
The form 1 is submitted and the Thank you message was shown on page
Now without refreshing or reloading the page, I have filled the form 2 and submitted the form 2.
The page reloaded and form 2 stays filled with values and is not submitted, and form 1 (which was submitted previously) is showing validation message.
Expected Results : form 1 should be loaded with empty values and form 2 should be submitted and should show Thank you message
Is it a bug in Umbraco form 8.2.0 which needs to be fixed? Or
This is just by design? If so, are there any workaround for this problem and how to fix this?
I had the same problem. To have two or more forms in the same page Umbraco Forms doesn't identify the current form properly. I was checking how Umbraco Forms Script targets the current form and I suppose it uses the #submit identifier of the Form.cshtml submit input. In our case, we have two inputs with the same submit identifier because the Form.cshtml is rendered for each form (twice). So, when some of the inputs are actived, both forms are submited.
To solve this problem, I created a script that contains a JS code to change the id of the submit input depending witch form is actived in my page. I used tab buttons to show the current form (actived form), so, I needed just to update the id of the input by the actived tab. The code I used is (using jquery):
Multiple different form on same page and submitting one form after another one triggers validation for first submitted form
I have two different form form1 and form2 on same page, both have fields that require validation.
Here are my steps:
Expected Results : form 1 should be loaded with empty values and form 2 should be submitted and should show Thank you message
Is it a bug in Umbraco form 8.2.0 which needs to be fixed? Or This is just by design? If so, are there any workaround for this problem and how to fix this?
Thank you.
Hi! Did you find a solution for this? I got the same bug in my website and I don't know what to do
Hello,
I had the same problem. To have two or more forms in the same page Umbraco Forms doesn't identify the current form properly. I was checking how Umbraco Forms Script targets the current form and I suppose it uses the
#submit
identifier of theForm.cshtml
submit input. In our case, we have two inputs with the same submit identifier because theForm.cshtml
is rendered for each form (twice). So, when some of the inputs are actived, both forms are submited.To solve this problem, I created a script that contains a JS code to change the id of the submit input depending witch form is actived in my page. I used tab buttons to show the current form (actived form), so, I needed just to update the id of the input by the actived tab. The code I used is (using jquery):
is working on a reply...