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="Send" method="POST" action="nextpage.htm">
<SCRIPT Language="JavaScript">
function processValidate(){
var Division= window.document.Send.v_tss_division.value;
if(Division==(""
)
{
alert("Please Select a Division"
;
Send.v_tss_division.focus();
return false;
}//end first if
}//end function
</script>
I then call this function like so:
<INPUT class="inputarisk" TYPE="button" value="Input Associated Risks" onclick="if (processValidate()){window.document.Send.Submit()};"
</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 "submit", 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
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="Send" method="POST" action="nextpage.htm">
<SCRIPT Language="JavaScript">
function processValidate(){
var Division= window.document.Send.v_tss_division.value;
if(Division==(""
{
alert("Please Select a Division"
Send.v_tss_division.focus();
return false;
}//end first if
}//end function
</script>
I then call this function like so:
<INPUT class="inputarisk" TYPE="button" value="Input Associated Risks" onclick="if (processValidate()){window.document.Send.Submit()};"
</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 "submit", 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