Monday, November 25, 2013

  1. #1
    prince is offlineRegistered User
    Join Date
    Jun 2004
    Posts
    51

    Stopping user from Multiple form submission?

    Hi All!

    I have to disable the submit button once the form has been submitted in the above code which uses image in place of submit button. Also you can see one method is already called onClick event. I am calling a function checknum(). Now i need a code wherein I want to disable submiting the form again and again by user. Please note that Checknum() is a must here.








    Please advise.
    Regards,
    Prince
  2. #2
    Vladdy's Avatar
    Vladdy is offlineHelper, not pleaser
    Join Date
    Nov 2002
    Location
    Nashua, NH
    Posts
    3,195
    Problem with multiple form submission should be handled server-side. The two issues: data integrity and user friendliness should be addressed in the coding. If you do not want to allow same submissions entered twice, verify that there is no existing record with submitted data before inserting a new one. Another possibility is to have a timestamp for each record and allow only one submission from user within a certain time period.
    User friendliness is accomplished by delivering part of the page before starting the form data processing:
    - when the form is recieved output the page header open body tag and a simple paragraph:
    Please wait while your submission is being processed

    - flush the output buffer and then start form processing
    - when done with form processing output the resulting page with a style element:


    You can use client side scripting to help reduce the server side load.
    The simplest and most reliable way of preventing multiple form submissions is adding the following line at the end of your data verification function:
    Code:
    function verify(form)
      { /* your form verification here */
        form.onsubmit = function(){return false;}
        return true;
      }
    Vladdy

    Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.
  3. #3
    prince is offlineRegistered User
    Join Date
    Jun 2004
    Posts
    51
    Many Thanks Vlady For your valuable advise. I shall keep this as note for my future need . For this perticular requirement i have a hardcoded stuff. I have two options only one is to disable the form as advised by you. Or to Make the submitt button inactive which is an image source here. Can you please offer some solution in these perspectives.

    Thanks & Regards,
    Prince.
  4. #4
    Vladdy's Avatar
    Vladdy is offlineHelper, not pleaser
    Join Date
    Nov 2002
    Location
    Nashua, NH
    Posts
    3,195
    Code:
    
    
    Vladdy

    Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.

No comments: