1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Rep Power
    We have set up a my SQL database on our intranet, and would like to prevent the form's submit button from being pressed repeatedly ( thus, re- entering the data )
    Any help would be greatloy appreciated
  2. #2
  3. No Profile Picture
    Seņor Member
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2000
    Rep Power
    I don't think you can do that, because the form can be re-submitted by reloading/refreshing the page. IMHO, the best thing to do is on the form that processes your code, check for if a session variable exists (call it whatever you want) and if not, set it to the current timestamp. If it does exist, check how close it is to the current timestamp and if it is within your tolerance (60 seconds would be good) don't process the information, but instead return a message that indicates they cannot submit the form more than once per whatever time increment you choose. Of course, you would need to do this with server-side code, not client-side code.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Rep Power
    You can achieve this by changing the value of the submit button as the form is going to be submitted.

    This code could go into the page header:

    showupload="Please Wait...";

    function confirmupload() {
    if(document.forms[0].upload.value!=showupload) {
    displaymessage = checkinfo();
    if(displaymessage != "") {
    } else {
    if(getconfirmation()) {

    function indicateupload() {

    The first line in the confirmupload function checks the value of the submit button, if = showupload the form will not be submitted.

    For your submit button you could use:

    document.write("<INPUT TYPE=\"button\" VALUE=\"Upload File\" NAME=\"upload\" ONCLICK=\"confirmupload()\">");

    When you click the submit button the value will change to that of showupload. You can then check the submit buttons value to see if the form has been submitted.

IMN logo majestic logo threadwatch logo seochat tools logo