You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been struggling with an issue that when using HX-Redirect or HX-Location headers, which effectively do client-side redirection, a form button is re-enabled before a new page is loaded.
Then the backend responds with header HX-Location: {"path": "/another-page", "target": "#body"}
When submitting a request, the button is properly disabled. But when the response is back and redirection still in progress, the button is re-enabled again. When the network is quite fast, it's almost invisible, but with slower connections, it's becoming an issue.
Is there any way I can extend disabling the button? Or how do you guys usually handle redirections after submitting a form?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi great community!
I've been struggling with an issue that when using
HX-Redirect
orHX-Location
headers, which effectively do client-side redirection, a form button is re-enabled before a new page is loaded.Sample code:
Then the backend responds with header
HX-Location: {"path": "/another-page", "target": "#body"}
When submitting a request, the button is properly disabled. But when the response is back and redirection still in progress, the button is re-enabled again. When the network is quite fast, it's almost invisible, but with slower connections, it's becoming an issue.
Is there any way I can extend disabling the button? Or how do you guys usually handle redirections after submitting a form?
Beta Was this translation helpful? Give feedback.
All reactions