How to Use the Built In Generated Modal
From ElixirBlocks
This page is in progress
defmodule AppWeb.PageLive do use AppWeb, :live_view def mount(_params, _session, socket) do {:ok, assign(socket, notes: "We are the world" )} end def handle_event("submit-modal-form", params, socket) do # Create Record IO.inspect(params) {:noreply, redirect(socket, to: "/")} end def render(assigns) do IO.inspect(assigns) ~H""" <%= for id <- 1..5 do %> <.modal id={"notes-modal-#{id}"}> <form phx-submit="submit-modal-form"> <input type="text" name="some-form-item" value={@notes} /> <input type="submit" phx-click={hide_modal("notes-modal-#{id}")} /> </form> </.modal> <div phx-click={show_modal("notes-modal-#{id}")}>Click item <%= id %></div> <% end %> """ end end