Hacker News new | ask | show | jobs
by akersten 2053 days ago
The proposed solution (an HTML attribute to 'allow' double-click submissions of <form>s) is backwards from how the standard would be updated.

The proposal should instead be for an attribute that prevents double-clicks, because that way browsers that have not implemented it still behave correctly. Additionally, you don't "break userspace" for millions of forms online that no longer work as the developer intended.

However, I'm skeptical that we need to encode this at all into the standard, since setting the `disabled` attribute on the submission button after submission is pretty much test case #0 of any serious online form development.

Amusingly, things have gotten a lot better since 2015 when this was written. That blob of JQuery is now replaced with binding the `disabled` attribute to `isSubmitted` state on your React-based webform. An interesting glimpse into the web-that-used-to-be.

2 comments

And it used to be even better than that before React and JQuery.

`<button onclick="this.disabled=true">button</button>` worked in the 90s.

Except that for the overwhelming majority (admittedly not literally all) of those forms, no-double-click is how the developer intended them to work. If anything, I call [citation needed] on the implication that there is any <form> anywhere that actually expects or relies on double-clicks producing two different HTTP requests.