"""
end
@impl true
def handle_event("submit", %{}, socket) do
report_event(socket, %{type: :submit, data: socket.assigns.data})
if socket.assigns.attrs.reset_on_submit do
reset_inputs(socket)
end
{:noreply, socket}
end
defp report_event(socket, attrs) do
topic = socket.assigns.attrs.ref
event = Map.merge(%{origin: socket.assigns.client_id}, attrs)
send(socket.assigns.attrs.destination, {:event, topic, event})
end
defp reset_inputs(socket) do
values =
for {field, input_attrs} <- socket.assigns.attrs.fields,
field in socket.assigns.attrs.reset_on_submit,
do: {input_attrs.id, input_attrs.default}
send(self(), {:set_input_values, values, true})
end
end