Prevent duplicate submission¶
Block a user from submitting the same form twice via rapid repeated clicks. OnLoad and Render for a OneClickSubmit button instance; client click for the guard script.
| Field | Value |
|---|---|
| Operation ID | OP-V2-009 |
| Trigger | OnLoad and Render for a OneClickSubmit button instance; client click for the guard script. |
| Inputs | CssClass (optional). |
| Outputs | A submit button whose client click is guarded against duplicate submission. |
| Primary components | OneClickSubmit |
| Entry point | SAIF.Presentation.Web.Controls.V2/OneClickSubmitControl.vb |
Steps¶
- On
OnLoad, setOnClientClicktoreturn OneClickOnly(). (BR-V2-058) - Register the
WasClickedflag variable script block and theOneClickOnly()function script block on the page, each only once. (BR-V2-059) - On
Render, apply the default CSS classNormalButtonwhen no CSS class has been set, then delegate to the base button rendering. (BR-V2-060)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([OnLoad]) --> Client["Set OnClientClick=return OneClickOnly()"]
Client --> Reg["Register WasClicked flag + OneClickOnly function once"]
Reg --> RenderS([Render])
RenderS --> Css{CssClass set?}
Css -->|No| Default[Apply NormalButton]
Css -->|Yes| Base[MyBase.Render]
Default --> Base
Base --> Done([Rendered])
Failure and edge-case behavior¶
- No exceptional failure handling beyond the branches described in Steps was found in the analysis findings.*
Related documentation¶
Sources¶
SAIF.Presentation.Web.Controls.V2/OneClickSubmitControl.vb