Repository navigation
|
I use a example to explain what i expected to do. Following is a search input element. input(
type: "search",
value: "#{context.request.query_params["q"]?}",
name: "q",
class: "s12 m8 input-field",
placeholder: "输入大学名称模糊搜索",
"hx-get": "/universities",
"hx-target": "#main",
"hx-select": "#main",
"hx-trigger": "search, keyup delay:400ms changed",
"hx-push-url": "true",
"hx-include": "???",
)I want to includes the # i can use href or hx-vals for add batch_level param, both is ok.
a(
href: "#!",
"hx-get": Index.path,
"hx-vals": "{\"batch_level\": \"#{bl.value}\"}",
"hx-push-url": "true"
) do
text bl.display_name
endSo, my question is, how to include the I tried add hx-vals like following code into search input to try to get the batch_level from template method input(
type: "search",
...
"hx-vals": "{\"batch_level\": \"#{context.request.query_params["batch_level"]?}\"}"
)But, it not work correctly if So, AFAIK, the left solution is two:
But. both of them out of my knowledge. Thanks |
Replies: 1 comment
|
Oops, i fix my issue for add a hidden input tag, which nested inside the div id: "main" do
....
input type: "hidden", name: "batch_level", value: context.request.query_params["batch_level"]?.to_s
...
endWhen i click the link, the server's response updated this input tag value use input(
type: "search",
...
"hx-include": "[name='batch_level']"
)It works! |
Oops, i fix my issue for add a hidden input tag, which nested inside the
div#main.When i click the link, the server's response updated this input tag value use
context.request.query_params,then, change search input use
hx-include.It works!