Disable submit button while Turbo form is submitting

14069
0

Double-submits are easy to trigger on slow connections, especially with Turbo where the page doesn’t visibly reload. I add a Stimulus controller that listens to turbo:submit-start and turbo:submit-end events on the form. On submit start, disable the submit button and optionally show a spinner. On submit end, re-enable unless the server redirected away. This improves UX and prevents duplicate records without needing complicated server-side idempotency for every form. I still keep server-side uniqueness constraints, but this is a good “first line of defense”. Because Turbo emits consistent events, the same controller works for normal page forms and for forms inside frames or modals.