Opened 5 years ago
Closed 4 months ago
#28889 closed Cleanup/optimization (fixed)
Use JavaScript to prevent double submission of admin forms
Reported by: | Manuel Saelices | Owned by: | Marcelo Galigniana |
---|---|---|---|
Component: | contrib.admin | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
For fast clickers.
Change History (15)
comment:1 Changed 5 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 5 years ago by
Triage Stage: | Unreviewed → Accepted |
---|
I think this is an improvement and the implementation looks reasonable.
comment:3 Changed 5 years ago by
Has patch: | set |
---|---|
Needs tests: | set |
Summary: | Prevent double submission on admin forms → Use JavaScript to prevent double submission of admin forms |
Type: | Bug → Cleanup/optimization |
I found an article titled JavaScript: Preventing Double Form Submission which might be worth reviewing. In particular, it points out "Rather than simply disabling the button, we can also change the text so that people don't get confused."
Did you consider trying to add some tests for the patch?
I share Nick's concern on the pull request that this may have a good chance of causing some regression in unconsidered edge cases. I'm not sure if it's considered a best practice these days. The article suggests that some browsers (e.g. IE11) treat a double click as a single click. It seems unfortunate if every project has to add something like this.
comment:4 Changed 4 years ago by
Owner: | changed from nobody to Karan Bedi |
---|---|
Status: | new → assigned |
comment:5 Changed 4 years ago by
I have created a PR. Please guide me how to proceeding further.
PR
comment:6 Changed 4 years ago by
Hi Karan,
Thanks for the input. Your fix includes the changes Nick suggested from the original PR. (Great.)
To get this merged we need to address Tim's concerns.
- Can we add some selenium tests, to exercise the behaviour?
- What's your assessment of the article Tim linked to? Do we need (still) to do this?
comment:7 Changed 4 years ago by
Hi Carlton,
- I am unable to reproduce the behavior, probably because till now, I am serving on localhost.
- In the article, there are different methods of implementing the same. One improvement can be changing the label of the submit button after a click.
- From the point of usability, there is just a comment by someone, which also doesn't seem concrete.
Please guide me on how to proceed further.
comment:8 Changed 13 months ago by
Owner: | Karan Bedi deleted |
---|---|
Status: | assigned → new |
comment:9 Changed 7 months ago by
Has patch: | unset |
---|---|
Owner: | set to Marcelo Galigniana |
Status: | new → assigned |
comment:10 Changed 6 months ago by
Has patch: | set |
---|---|
Needs tests: | unset |
comment:11 Changed 6 months ago by
Patch needs improvement: | set |
---|
comment:13 Changed 5 months ago by
I think thibaudcolas's comment in 1st approach makes sense: https://github.com/django/django/pull/15217#issuecomment-1018935149
So I updated the PR to go for the first option
comment:14 Changed 4 months ago by
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Fixed on this Pull Request: https://github.com/django/django/pull/9425