I have a liveview form and a text input:
<%= search_input :filter, :search, id: "filter_search_field", class: "input", placeholder: "Search", value: @search_field, "phx-debounce": "300"%>
Now there is a moment when I want to clear this field programatically, I do this by changing the assign:
{:noreply, assign(socket, :search_field, "")}
The problem with this is that the phx-change
event assigned to the form is not triggered.
I also tried to create a JS hook and change the value of the field from the hook, however that does not create event either.