I have a form where the user can select one of a few payment options. One of the options uses a third party that injects iframes into the page to collect credit card data from the user, and those fields need to be submitted via JS. To accomplish this, I use push_event
when the form is submitted (along with some other server-side tasks), which works as expected. My issue is that using push_event
turns off the form loading state, which makes the form look like nothing is happening.
I could use JS to put the phx-submit-loading
class back on the button during the push_event
but I wonder if there is a better solution? Is there a way to keep the loading state on the form while waiting for the client to respond, like a server-side version of pushEvent
?