sezaru
How to differentiate clicked button in form from others?
I have a LiveView with a form that has 2 buttons, a skip button and a submitbutton.
Both buttons have a CSS that checks if the button has the phx-submit-loading and shows a loading svg.
The issue is that I only want to change the loading in the button that I clicked, so, if I click in the skip button, I want to show the loading SVG in that button until the server replies. Same thing for the submit button.
But right now, it seems that LiveView will add the phx-submit-loading to all buttons instead of the one I clicked, and it doesn’t add any other class to the button I clicked. meaning that I don’t have a way to differentiate between them, and the loading svg ends up showing in both buttons which seems confusing for the user.
Most Liked
sezaru
I just opened a issue to see if they can add that, let’s see what the devs say ![]()
sodapopcan
Ah ok, I thought so but was tired of spinning up Phoenix apps to check ![]()
sezaru
Doesn’t seem to work for me. Also, won’t the button lose focus if the user clicks anywhere else?








