Hi, If in the next code, I would like to know if it is a bad practice the handling of the submit event. In that case, is there any other alternative code?
<form submit="save_submit" change="validate">
<form id="form1" submit="save_submit" change="validate">
</form>
<form id="form2" submit="save_submit" change="validate">
</form>
</form>
def handle_event("save_submit", _params, socket) do
# Submission logic for the parent form
{:noreply, socket}
end
def handle_event("save_submit", %{"id" => "form1"}, socket) do
# Submission logic for the child form 1
{:noreply, socket}
end
def handle_event("save_submit", %{"id" => "form2"}, socket) do
# Submission logic for the child form 2
{:noreply, socket}
end