File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,24 @@ Here is a meta tag allowing all responses to swap:
118118 <meta name =" htmx-config" content =' {"responseHandling": [{"code":"...", "swap": true}]' >
119119```
120120
121+ ## ` GET ` Requests on Non-Form Elements Do Not Include Form Values by Default
122+
123+ If a non-form element makes a non-` GET ` request (e.g. a ` PUT ` request) via htmx, the values of the enclosing form
124+ of that element (if any) [ will be included in the request] ( @/docs#parameters ) .
125+
126+ However, if the element issues a ` GET ` , the values of an enclosing form will
127+ [ not be included.] ( https://github.com/bigskysoftware/htmx/blob/fb78106dc6ef20d3dfa7e54aca20408c4e4336fc/src/htmx.js#L3525 )
128+
129+ If you wish to include the values of the enclosing form when issuing an ` GET ` you can use the
130+ [ ` hx-include ` ] ( @/attributes/hx-include.md ) attribute like so:
131+
132+ ``` html
133+ <button hx-get =" /search"
134+ hx-include =" closest form" >
135+ Search
136+ </button >
137+ ```
138+
121139## History Can Be Tricky
122140
123141htmx provides support for interacting with the broswer's [ history] ( @/docs.md#history ) . This can be very powerful, but it
You can’t perform that action at this time.
0 commit comments