Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Submit Function 1

Status
Not open for further replies.

cdumigan

MIS
Feb 5, 2002
16
0
0
IE
Hi,
I am trying to create a function that will perform form validation, and then submit the form! If the validation returns true (no errors on form), then I want the form to submit, otherwise the form should not submit!
The following is what I have at the moment:
<form name=&quot;Send&quot; method=&quot;POST&quot; action=&quot;nextpage.htm&quot;>
<SCRIPT Language=&quot;JavaScript&quot;>
function processValidate(){
var Division= window.document.Send.v_tss_division.value;

if(Division==(&quot;&quot;))
{
alert(&quot;Please Select a Division&quot;);
Send.v_tss_division.focus();
return false;
}//end first if

}//end function

</script>

I then call this function like so:

<INPUT class=&quot;inputarisk&quot; TYPE=&quot;button&quot; value=&quot;Input Associated Risks&quot; onclick=&quot;if (processValidate()){window.document.Send.Submit()};&quot;
</form>

With this method the validation is performed, but the form does not submit as I want, if no errors (validation) are found. If I change the button type to &quot;submit&quot;, then the form submits regardless of the result of the validation.

Can anyone suggest wht I'm doing wrong, or maybe suggest a better way of doing this??

Thanks in advance,
C
 
Hi, read thread216-226085
I just answered this question there.
 
This is fantastic!! Works perfectly. Thanks a million for your help, it's much appreciated.
C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top