htmx
htmx copied to clipboard
hx-post with external submit button excludes the button value
Submitting a form with the submit button outside of the <form> tag does not include the button's name attribute as a parameter or its value ('lol': 'cats') in the request which is inconsistent with the default expected behaviour.
<form id="my-form" hx-post="/example">
<input type="text" name="name" />
</form>
<input type="submit" form="my-form" name="lol" value="cats"/>
Same issue here with the newest version 1.8.5.
Also ran into this issue. It popped up when I was trying to use form buttons inside a Bootstrap modal footer. For anyone in the same boat- I ended up having to wrap the entire modal-dialog div in the form tag, which isn't ideal.
Resolved by #1559