You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I should get to creating tiny project to show the behavior, but I've noticed that the value of a submit button is not included when a form is marked with hx-get. Has anyone also ran into this issue?
I expected the value of the button (name=offset in this example) to be included when I have a form like this, but it is not included in the HTMX request. If I change this to a plain form with method=get, the offset parameter is included as a query parameter.
<formhx-get="Chart" hx-trigger="change"><buttontype="submit" name="offset" value="-1">
Previous
</button><!-- some stuff with more fields --><buttontype="submit" name="offset" value="1">
Next
</button></form>
I've written the above form like below to work around the value of the button not being included, but obviously there is more duplication.
<formhx-get="Chart" hx-trigger="change"><buttonhx-get="Chart" hx-include="closest form" hx-vals='{ "offset": -1 }'>
Previous
</button><!-- some stuff with more fields --><buttonhx-get="Chart" hx-include="closest form" hx-vals='{ "offset": 1 }'>
Next
</button></form>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I should get to creating tiny project to show the behavior, but I've noticed that the value of a submit button is not included when a form is marked with
hx-get. Has anyone also ran into this issue?I expected the value of the button (
name=offsetin this example) to be included when I have a form like this, but it is not included in the HTMX request. If I change this to a plain form withmethod=get, theoffsetparameter is included as a query parameter.I've written the above form like below to work around the value of the button not being included, but obviously there is more duplication.
Beta Was this translation helpful? Give feedback.
All reactions