I’m currently re-writing my form to create/edit Log entries with Phoenix Live View. I have an unorthodox UI - it has 2 submit buttons. 1 for “Work” and one for “Break” - offering the user the choice, but allowing the user to submit the form at the same time. So at the time of submitting the form - I need to know which button the user pressed.
In a traditional POST I use the name of the button - in my template I have the following:
<%= submit "Work", name: "work" %> <%= submit "Break", name: "break" %>
If the user clicks a button, either
break would exist in the list of params.
In a Live View, I don’t have this technique at my disposal.
handle_event does not include the name of the submit button that was pressed.
I tried adding a
phx-value-work attribute (which seems like an awesome way to solve this), but that only works with
Does anybody have any suggestions?