If it’s of any help, I copied your example code and created a handle_event
for phx-change
and it worked just fine.
def handle_event("switch", params, socket) do
IO.inspect params
{:noreply, socket}
end
IEx output
%{
"_csrf_token" => "...",
"_target" => ["system_switch", "system_switch"],
"system_switch" => %{"system_switch" => "off"}
}