Skip to content

Instantly share code, notes, and snippets.

@BenSchZA
Last active August 5, 2020 21:02
Show Gist options
  • Save BenSchZA/cbff61e6002b13caf40dfcb9cc311283 to your computer and use it in GitHub Desktop.
Save BenSchZA/cbff61e6002b13caf40dfcb9cc311283 to your computer and use it in GitHub Desktop.
<%= f = form_for :select_user_type, "#", [phx_change: :select_user_type, phx_value_id: creds.id, class: "ui form"] %>
<%= select(f, :role, ["Admin": "admin", "User": "user"]) %>
</form>
def handle_event("select_user_type", %{"select_user_type" => %{"role" => role}}, socket) do
IO.inspect socket.assigns
{:noreply, socket}
end
<form action="#" class="ui form" method="post" phx-change="select_user_type" phx-value-id="1">
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment