Stopping double submission of form

Results 1 to 3 of 3

Thread: Stopping double submission of form

  1. #1
    Join Date
    Dec 1969

    Default Stopping double submission of form

    I have a problem with some people posting the same job twice on my job site. <BR><BR>One thing that may be happening is that they enter the job ad, want to edit what they see and, instead of hitting my nice Edit This Ad link, hit the Back button, which of course submits the ad again.<BR><BR>Can you think of a way round this?<BR>

  2. #2
    Join Date
    Dec 1969

    Default I use a cookie usually

    In the form I put a hidden field to stamp the form with a unique id, usually use date/time:<BR><BR>&#060;form action="formname.asp"&#062;<BR>&#060;input type="hidden" name="FormCookie" value="&#060;%=Now%&#062;"&#062;<BR>&#060;input type="text" name="fieldname1"&#062;<BR>&#060;input type="text" name="fieldname2"&#062;<BR>&#060;/form&#062;<BR><BR>then when they submit I check the form cookie against what I get back from post, if they are the same this "instance" of the form has already been submitted and should be ignored. If not I submit the request and then write the cookie with the unique ID from the request:<BR><BR>If Request.Cookies("FormCookie") &#060;&#062; Request.Form("FormCookie") Then<BR><BR> &#039; Do your database submission and whatever other work here <BR><BR> &#039; write to the form cookie with the id from this form<BR> Response.Cookies("FormCookie") = Request.Form("FormCookie") <BR><BR>End If

  3. #3
    Join Date
    Dec 1969

    Default RE: Stopping double submission of form

    I disable my submit buttons after they have been clicked, using JavaScript. This way, when the user hits the browser back button, the submit is grayed out. We have a lot of users, but, they do not realize that if they refresh the screen the submit button will enable. This is also helpful when the server is running on the slow side, as the users like to click the submit button a thousand times when the page doesn&#039;t submit right away.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts