Problem with having a "form" inside of a "form" #8241
Unanswered
DanceParty
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Instead of managing two distinct form submissions, consider detecting new category submissions within the existing form. By handling this within the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First off, I am aware that no form should contain another form element, but I am unsure how to phrase this question differently...
Also I am quite new to remix and loving it, but I was unable to figure out how to approach this problem even after reading documentation and searching the other discussions.
The shortened version of my problem is such:
I have a form to submit a line item, and within that form, I have a "new category" input where the user should be able to add a new category on the fly (db call) by pressing "Enter". However, I am running into issues where pressing Enter either doesn't do anything (because I can add an
event.preventDefault()
) or submits the form by triggering the "submit" button at the end of the line item form.My goal is that when the input is focused and the user presses enter, I can try submitting the new "Category" to the database. I am aware of the
actionId
trick but that seems to fit the problem where you have more than one form per component, but instead I have almost the reverse problem where one form with two actions(?)I can try summarizing the code if that would be helpful too~
Beta Was this translation helpful? Give feedback.
All reactions