Skip to content

Conversation

@yujiteshima
Copy link

Description

Improve the hx-vals documentation to address common user confusion, especially regarding its use with hx-post and other non-GET HTTP methods.

Changes made:

  1. Added "Using hx-vals with hx-post" section

    • Example showing hx-vals with hx-post
    • Clarified that hx-vals works with all HTTP methods (POST, PUT, PATCH, DELETE)
    • Explained the difference: non-GET requests include values in the request body, while GET requests append them as query parameters
  2. Added "JSON Syntax Requirements" section

    • Documented a common pitfall: using single quotes inside JSON ({'key': 'value'}) which silently fails
    • Provided correct examples using double quotes inside JSON
    • Warned that malformed JSON is silently ignored, making debugging difficult

These additions address user feedback in issue #1134, where multiple users reported spending significant time debugging issues that could have been avoided with clearer documentation.

Corresponding issue: #1134

Testing

This is a documentation-only change. No functional code was modified.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

- Add section explaining hx-vals works with all HTTP methods (POST, PUT, etc.)
- Document the difference between GET (query params) and non-GET (request body)
- Add JSON syntax requirements section with common pitfalls
- Clarify that malformed JSON is silently ignored

Fixes bigskysoftware#1134
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.

1 participant