Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow expression vars to override raw parameters #232

Merged
merged 1 commit into from
Nov 15, 2020
Merged

Conversation

bencroker
Copy link
Sponsor Collaborator

@bencroker bencroker commented Nov 11, 2020

This PR allow expression vars to override raw parameters.

Before:

<form hx-get="">
    <inpup type="hidden" name="temperature" value="0">
    <button type="submit" hx-vars="temperature: -23">Go sub-zero</button>
</form>

<!-- Submits {temperature: 0} -->

After:

<form hx-get="">
    <inpup type="hidden" name="temperature" value="0">
    <button type="submit" hx-vars="temperature: -23">Go sub-zero</button>
</form>

<!-- Submits {temperature: -23} -->

@bencroker
Copy link
Sponsor Collaborator Author

@1cg I just found a test called hx-vars do not override inputs, so this is by design?
https://github.com/bigskysoftware/htmx/blob/dev/test/attributes/hx-vars.js#L62-L73

@1cg
Copy link
Contributor

1cg commented Nov 15, 2020

I don't see a compelling reason that it was done this way. Seems like the hx-vars is more local to the call and so it should have precedence.

I'll pull and modify the test.

@1cg 1cg merged commit 9048750 into dev Nov 15, 2020
@bencroker
Copy link
Sponsor Collaborator Author

Thanks!

@bencroker bencroker deleted the bencroker-patch-1 branch November 15, 2020 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants