Reputation: 13
I am having a problem with sending additional form data when submitting a form in HTMX:
First form:
<form class="inline" hx-post="some-url" hx-target="#item-navbar"
hx-swap="outerHTML" hx-include="#item-form" hx-trigger="submit">
<input value="hello" name="hello_input">
<input type="submit value="Click me!">
<form>
Second form:
<form id="item-form">
<input name="some_name" value="3">
</form>
When setting the hx-include="[name= 'some_name']"
it does successfully include the input inside the post request. In reality I have many more inputs inside the item-form and I would like to send all. What could be the problem? It says in the DOCS that selecting a parent element should return all the descendant inputs.
The error is that the request is never even sent. No request is seen on the server nor on "Network".
Any help would be appreciated.
Upvotes: 1
Views: 1791
Reputation: 13
It turned out that the form needs to be valid in order for you to get any of the inputs underneath it.
Upvotes: 0