Question:

How can you stop someone from clicking submit more than once?

by  |  earlier

0 LIKES UnLike

On a web page?

 Tags:

   Report

6 ANSWERS


  1. Use javascript or use server side programming. In javascript, you can add this little code (document. form1. submit1. disabled = true; <<< be sure to remove spaces) as in the following example:

    <form name="form1" onsubmit="document.form1.submit1.disable... = true;">

    <input type="submit" name="submit1" value="Submit Form">

    </form>

    This is the trick Yahoo! answers uses as well (:


  2. Probably best to assume they will click more than once then fix your server side code to deal with it... keep a session id and check it before processing to see if the transaction has already happened.

  3. There is no fool-proof method if the clicker is fast enough...

    ... otherwise:

    Add an onclick event to the submit button that doesn't prevent the form from submitting, but either:

    a. HIDEs the button (always fun)

    b. DISABLEs the button (using the "disabled=true" option)

    c. REPLACEs the button with something else

    But whether or not it works (or how fast it responds) depends on the browser and how fast someone clicks.

  4. Duct tape him.

  5. I suggest finding an example, looking in the source code, and copying it.

  6. Use javascript to disable the submit button once clicked.  This will be client-side so it will be instant.

Question Stats

Latest activity: earlier.
This question has 6 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.