Logic of creating FormData from submission is missing submitter handling #1486
pawelblaszczyk5
started this conversation in
Ideas
Replies: 2 comments
-
Thanks @pawelblaszczyk5 if you could include some example HTML of what this looks like that would help. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yeah, sure 😃 <form action="/" method="post">
<button name="additional_value_key" value="foo">Submit with additional value</button>
<button formaction="/different-url">Override URL</button>
<button formmethod="get">Override method</button>
</form>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Please provide the environment you discovered this bug in.
I've actually just discovered it via looking through the code after seeing announcement of 1.10 release on Twitter haha. Pardon not providing reproduction, but I can pinpoint exact lines and so I hope that's fine too 😄
Which area/package is the issue in?
router
Description
Currently
FormData
(and the form method/action) is just created from theevent.target
on form submission event. However, if form is submitted via button/input with button/image type it can carry additional information and e.g. override form action itself.Here's an example code from React Router that does similar thing. As you can see it uses the
submitter
property from event to carry additional info for submission.Btw. I've tried to look through the code and it seems like the
action
prop isn't doing anything currently? 😄Please provide the exception or error you saw
Other information
n/a
I would be willing to submit a PR to fix this issue
Beta Was this translation helpful? Give feedback.
All reactions