Skip to content

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

  1. On OnLoad, set OnClientClick to return OneClickOnly(). (BR-V2-058)
  2. Register the WasClicked flag variable script block and the OneClickOnly() function script block on the page, each only once. (BR-V2-059)
  3. On Render, apply the default CSS class NormalButton when 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.*

Sources

  • SAIF.Presentation.Web.Controls.V2/OneClickSubmitControl.vb