The following validation code works fine, however, I'd like to use an image as my submit button. When I change the button to: <INPUT TYPE="image" SRC="images/pic.gif"> the validation code still works, however, it doesn't stop the form from being submitted. I've tried a thousand variations including: Sub myForm_OnSubmit() without success. Any suggestions will be GREATLY appreciated.
<FORM ID="myForm" METHOD="POST" ACTION="somepage.asp">
<INPUT TYPE="text" NAME="field1" SIZE="30">
<INPUT TYPE="button" NAME="myButton">
</FORM>
<SCRIPT LANGUAGE="vbscript">
Sub myButton_OnClick()
If Len (myForm.field1.value) = 0 Then
Alert "Please enter a value."
myForm.field1.focus
Exit Sub
End If
Call myForm.submit()
End Sub
</SCRIPT>
<FORM ID="myForm" METHOD="POST" ACTION="somepage.asp">
<INPUT TYPE="text" NAME="field1" SIZE="30">
<INPUT TYPE="button" NAME="myButton">
</FORM>
<SCRIPT LANGUAGE="vbscript">
Sub myButton_OnClick()
If Len (myForm.field1.value) = 0 Then
Alert "Please enter a value."
myForm.field1.focus
Exit Sub
End If
Call myForm.submit()
End Sub
</SCRIPT>