Hi elixir forum,
I’m new to elixir and phoenix. I’m currently checking out Live View and have come across the following problem:
I want to have a modal form which performs live validation but I want to show and hide the modal without having to make a roundtrip to the server (as I think I should not be using live view for something that is not data-oriented, like displaying a form).
However, when I try to display the modal using JS , it gets patched (as expected) and hidden whenever an event happens in the LV.
What would be the correct approach here? My takes:
- Use phx-update=“ignore”. Cons: I lose live validation as any child elements of the modal (ie. the form) will get ignored.
- Use a live view for the form inside a dead view, show modal with JS. Cons: I lose live navigation
- Use a live view for the form inside a live view for the page, while also using phx-update=ignore. (Will this even work?)
Cheers!