htmx icon indicating copy to clipboard operation
htmx copied to clipboard

hx-post with external submit button excludes the button value

Open wooooodward opened this issue 3 years ago • 2 comments

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"/>

wooooodward avatar Nov 04 '22 18:11 wooooodward

Same issue here with the newest version 1.8.5.

mihalikv avatar Mar 03 '23 07:03 mihalikv

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.

drowe-official avatar Jun 06 '23 07:06 drowe-official

Resolved by #1559

alexpetros avatar Sep 20 '23 22:09 alexpetros