How to prevent submit in nested form
See original GitHub issueI have a nested form that looks like this
//this is the form
<form>
// this for quick add functionality and display the data from the form above
<form>
</form>
</form>
The problem I have is when the children submit the data, it also trigger the submit from the parent, is there any way to prevent this from happening. P/S: also, how to trigger submit form <button>, something like <button onClick={() => handleSubmit()}>submit</button>
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Prevent form inside a form from being submitted - Stack Overflow
Forms should not be nested. The behaviour of such invalid markup is not specified. You should fix the markup. If, for some reason,...
Read more >Preventing form submission with dynamic nested forms : r/rails
Preventing form submission with dynamic nested forms. I have a set up where users can add answer options to quizzes with nested forms....
Read more >react hook form nested | The AI Search Engine You Control
React Hook Form: Submit a form with nested components or extract fields of ... You could use the hook useFormContext to avoid to...
Read more >Nested Forms - Apache Software Foundation
It might be a good idea to use input instead of button elements in your form hierarchy. IE tends to send all button...
Read more >InDepth Guide for Creating Nested and Reusable Forms
Introduction; How to create and use FormGroup; How to create nested form-groups ... <button type="submit" [disabled]="profileFormGroup.invalid"> Submit form ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I also ran into same issue. I was able to solve it by modifying my submit function to
e.stopPropagation()
can stopsubmit
from nested form