<form phx-change={"search_users"}>
<input
type="text"
name="query"
placeholder="search users"
/>
</form>
I have this form that searches/filters displayed users live on page. However when user list changes, or there’s disconnect etc. form resets (visually) to empty string.
So now I want to make the form change url search params, e.g. example.com?query=<my query>
and then handle this with handle_params
in LiveView. That way form state is saved in query string.
Is this possible with JS, e.g. like
<form phx-change={JS.patch(~p"?query=<form_value>")}>
<input
type="text"
name="query"
placeholder="search users"
/>
</form>
``` ?