Hi. I have a problem with handling phx-change on a form in liveview. I am creating a search field for filtering a list of objects. The field also has a reset button. It looks like this
<form phx-change="search-change" phx-submit="search-change">
<input type="text" name="search" value="<%= @search_list %>" placeholder="Search..." phx-debounce="500" />
<button type="button" phx-click="search-change" phx-value-search="">X</button>
</form>
The search field is in liveview not in a liveview component. Handler is implemented this way:
@impl true
def handle_event("search-change", _, socket) do
IO.inspect("Searching...")
{:noreply, socket}
end
Everything works as expected when I refresh the page where the list of objects and search field itself is. But when I live redirect to another page and then live redirect back, the form does not throw events anymore. The reset button still works and throws events.
Could you please help me with this