I have a html form. Inside the form, I have another form, which is also inside a bootstrap modal. When I submit second form, the first form will be submitted. How to fix this problem?
Asked
Active
Viewed 53 times
-7
-
Welcome to Stack Overflow. Please show your latest non-working attempt at solving this problem. It is usually more instructive to see fixes to your code than to read someone else's solution. See https://stackoverflow.com/help/how-to-ask – Athul Nath Feb 26 '18 at 07:21
-
For your question, please read this https://stackoverflow.com/questions/3430214/form-inside-a-form-is-that-alright – Abhishek Feb 26 '18 at 07:26
-
Please add some code to your question, so we can better understand your question and possibly identify the issue(s). Read [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) before adding your code. – Filnor Feb 26 '18 at 07:31
1 Answers
0
It is not possible to have a form in a form.
Split the forms, and if you want to access an input field outside the form tags use it as this:
<input type="checkbox" name="product" value="1" form="pushForm">
<form id="pushForm" role="form" method="POST" action="/products/add"></form>

ThomasV
- 346
- 3
- 16