Hi Dan,

It looks like you nearly have it. You just need to increment submitcount and
add the conditional. viz

var submitcount=0;
function submitForm(s)  {
   if(!submitcount){
      s.value = "  Sending...  ";
        submitcount++
      return true;
   }else{
        return false;
   }
}

When I do this, I use a hidden input rather than a global js variable to
remember the value. I think the browser does a better job of remembering the
values of form inputs when a page is reloaded from the back button.

Regards Simon
-----Original Message-----
From: Dan Stein [mailto:[EMAIL PROTECTED]]
Sent: 02 August 2002 12:14
To: Multiple recipients of list witango-talk
Subject: Witango-Talk: [OT] Combining two JavaScript's


I am trying to use the code below which forces a submit button to only be
used once with code in the attached file that causes the submit button to
change to sending when it is pressed. I really want both functions but I am
too JavaScript disabled to figure out how to get them both to work in the
same results page.

Dan


-- 
Dan Stein
Digital Software Solutions
799 Evergreen Circle
Telford PA 18969
Land: 215-799-0192
Mobile: 610-256-2843
Fax 413-410-9682
FMP, WiTango, EDI,SQL 2000
[EMAIL PROTECTED]
www.dss-db.com


>>> 
>> =====================
>> <!-- THREE STEPS TO INSTALL SUBMIT ONCE:
>> 
>>   1.  Copy the coding into the HEAD of your HTML document
>>   2.  Add the onLoad event handler into the BODY tag
>>   3.  Put the last coding into the BODY of your HTML document  -->
>> 
>> <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
>> 
>> <HEAD>
>> 
>> <SCRIPT LANGUAGE="JavaScript">
>> 
>> <!-- This script and many more are available free online at -->
>> <!-- The JavaScript Source!! http://javascript.internet.com
>> <http://javascript.internet.com/> -->
>> 
>> <!-- Begin
>> var submitcount=0;
>> 
>> function reset() {
>> document.emailform.name.value="";
>> document.emailform.email.value="";
>> document.emailform.comments.value="";
>> }
>> 
>> function checkFields() {                       // field validation -
>> if ( (document.emailform.name.value=="")  ||   // checks if fields are
blank.
>>      (document.emailform.email.value=="") ||   // More validation scripts
at
>>      (document.emailform.comments.value=="") ) //
forms.javascriptsource.com
>>    {
>>    alert("Please enter your name, email, and comments then re-submit this
>> form.");
>>    return false;
>>    }
>> 
>> else
>>    {
>>    if (submitcount == 0)
>>       {
>>       submitcount++;
>>       return true;
>>       }
>>    else
>>       {
>>       alert("This form has already been submitted.  Thanks!");
>>       return false;
>>       }
>>    }
>> }
>> //  End -->
>> </script>
>> </HEAD>
>> 
>> <!-- STEP TWO: Insert the onLoad event handler into your BODY tag  -->
>> 
>> <BODY OnLoad="reset()">
>> 
>> <!-- STEP THREE: Copy this code into the BODY of your HTML document  -->
>> 
>> <form method=post action="http://cgi.freedback.com/mail.pl";
>> name="emailform" onSubmit="return checkFields()">
>> 
>> <input type=hidden name=to value="[EMAIL PROTECTED]">
>> <input type=hidden name=subject value="Feedback Form">
>> 
>> <pre>
>> Your Name:   <input type=text name="name">
>> Your Email:  <input type=text name="email">
>> 
>> Comments?
>> 
>> <textarea name="comments" wrap="virtual" rows="7" cols="45"></Textarea>
>> 
>> <input type=submit value="Submit Form!">
>> 
>> [ Click the submit button twice to see the script in action ]
>> </pre>
>> </form>
>> 
>> <p><center>
>> <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
>> by <a href="http://javascriptsource.com";>The JavaScript Source</a></font>
>> </center><p>
>> 
>> <!-- Script Size:  2.05 KB -->
>> 
>> ===========
>>



********************************************************************
This message is intended only for the use of the person(s) ("the intended
recipient(s)") to whom it is addressed. It may contain information which is
privileged and confidential within the meaning of applicable law. If you 
are not the intended recipient, please contact the sender as soon as
possible. The views expressed in this communication may not necessarily
be the views held by LGCSB (Local Government Computer Services Board).
 
Any attachments  have been checked by a virus scanner and appear to be 
clean.
Please ensure that you also scan all messages, as LGCSB does not accept
any liability for contamination or damage to your systems.


********************************************************************

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to