Form "Submit once only" problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Bradbury

    #1

    Form "Submit once only" problems

    Hi

    On my form, as soon as the user clicks my submit button a message pops
    up saying "Form processing" as the form submits. This is fine as long
    as the user only clicks the submit button once. However, if I try and
    stop the user submitting a second time (if they click the button for a
    second time despite the form processing message) by using a submission
    counter then my form just hangs forever with the "Form processing"
    message. Any ideas? Here's the javascript:

    <script language="JavaS cript">
    <!--
    var submitcount = 0


    function checkMe(){
    if (submitcount ==0){
    with(document.f orms.worldcup){
    if(name.value == ""){
    alert("You must enter your name")
    return;
    }

    if(company.valu e == ""){
    alert("You must enter your company");
    return;
    }


    if(email.value. indexOf("@") == -1){
    alert("You must enter a valid e-mail address")
    return;
    }




    submitcount++
    document.all.pl easewaitScreen. style.display=" block";
    document.forms. worldcup.submit ();



    }}

    }
    //-->
    </script>

    The document.all.pl easewaitscreen is a div tag as follows:

    <DIV ID="pleasewaitS creen" STYLE="position :absolute;z-index:5;
    top:50%; display:none; width:100%;">
    <TABLE ALIGN="CENTER" BGCOLOR="#00000 0" BORDER="1"
    BORDERCOLOR="#0 00000" CELLPADDING="0" CELLSPACING="0" HEIGHT="50"
    WIDTH="150" ID="Table1">
    <TR>
    <TD WIDTH="100%" HEIGHT="100%" BGCOLOR="silver " ALIGN="CENTER"
    VALIGN="MIDDLE" >
    <FONT FACE="Arial" SIZE="4" COLOR="blue"><B >Processing<b r>
    Please Wait</B></FONT>
    </TD>
    </TR>
    </TABLE>
    </DIV>


    And finally, the user submits when they click on an image of a
    football:

    <p> <a href="javascrip t:checkMe();">< img
    src="images/footballsubmit. jpg" border="0"></a>
  • steve stevo

    #2
    Re: Form &quot;Submit once only&quot; problems

    Have you tried disabling the submit button after form starts processing ?

    hope this helps

    Simon Christie

    "David Bradbury" <davidbradbury@ etoast.com> wrote in message
    news:49f104d4.0 310220225.20609 1b1@posting.goo gle.com...[color=blue]
    > Hi
    >
    > On my form, as soon as the user clicks my submit button a message pops
    > up saying "Form processing" as the form submits. This is fine as long
    > as the user only clicks the submit button once. However, if I try and
    > stop the user submitting a second time (if they click the button for a
    > second time despite the form processing message) by using a submission
    > counter then my form just hangs forever with the "Form processing"
    > message. Any ideas? Here's the javascript:
    >
    > <script language="JavaS cript">
    > <!--
    > var submitcount = 0
    >
    >
    > function checkMe(){
    > if (submitcount ==0){
    > with(document.f orms.worldcup){
    > if(name.value == ""){
    > alert("You must enter your name")
    > return;
    > }
    >
    > if(company.valu e == ""){
    > alert("You must enter your company");
    > return;
    > }
    >
    >
    > if(email.value. indexOf("@") == -1){
    > alert("You must enter a valid e-mail address")
    > return;
    > }
    >
    >
    >
    >
    > submitcount++
    > document.all.pl easewaitScreen. style.display=" block";
    > document.forms. worldcup.submit ();
    >
    >
    >
    > }}
    >
    > }
    > //-->
    > </script>
    >
    > The document.all.pl easewaitscreen is a div tag as follows:
    >
    > <DIV ID="pleasewaitS creen" STYLE="position :absolute;z-index:5;
    > top:50%; display:none; width:100%;">
    > <TABLE ALIGN="CENTER" BGCOLOR="#00000 0" BORDER="1"
    > BORDERCOLOR="#0 00000" CELLPADDING="0" CELLSPACING="0" HEIGHT="50"
    > WIDTH="150" ID="Table1">
    > <TR>
    > <TD WIDTH="100%" HEIGHT="100%" BGCOLOR="silver " ALIGN="CENTER"
    > VALIGN="MIDDLE" >
    > <FONT FACE="Arial" SIZE="4" COLOR="blue"><B >Processing<b r>
    > Please Wait</B></FONT>
    > </TD>
    > </TR>
    > </TABLE>
    > </DIV>
    >
    >
    > And finally, the user submits when they click on an image of a
    > football:
    >
    > <p> <a href="javascrip t:checkMe();">< img
    > src="images/footballsubmit. jpg" border="0"></a>[/color]


    Comment

    Working...