question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update docs/#parameters with note about button values

See original GitHub issue

EdGuiness wrote:

Reading the docs I note that

…an element that causes a request will include its value if it has one…

So therefore I had expected this…

        <button hx-post="serverAction"
                hx-target="closest .insert-me"
                hx-swap="afterbegin"
                value="abc"
                class="btn btn-primary btn-sm">

…to send the value “abc” to the server in Form data, but it doesn’t?

What I do see is a header hx-active-element-value containing the “abc” value.

chg20 replied:

Yeah, buttons are a little tricky The way that forms work is that on submit they will include the clicked button value, but that is hard to do consistently from a dynamic ajax context … to complete the thought: since I didn’t feel I could consistently provide the value for buttons in all expected contexts, I chose to provide the active element (the usual hack work around for this button problem) as exactly that: the active element, so that there is truth in advertising.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bencrokercommented, Sep 16, 2020

Couldn’t we exclude all buttons except for the one that triggered the event?

0reactions
1cgcommented, Jul 6, 2021

in the next release we will include the value of the clicked button in forms

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the parameter update button | Create & View Content
The parameter update button lets users decide when changes in filters should be applied to the connected visualizations. This is useful when you...
Read more >
Parameters For Apex Buttons & Calls to Create S-Docs
The following parameters can be appended to an Apex button or to the end of an S-Doc creation call. Note: These parameters are...
Read more >
Create a parameter query (Power Query)
To use a new parameter, select New Parameter, and then create a parameter. Enter the new date in the Current Value box, and...
Read more >
The Button element - HTML: HyperText Markup Language
This value is passed to the server in params when the form is submitted using this button. Notes. A submit button with the...
Read more >
Method: spreadsheets.values.update | Google Sheets
Query parameters ; valueInputOption. enum ( ValueInputOption ). How the input data should be interpreted. ; includeValuesInResponse. boolean. Determines if the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found