I have a form and am trying to get it to validate before submitting, but for some reason, I do not get anything, it just submits....
Any ideas?
The calling form is
Any insights greatly appreciated.
Jim
Any ideas?
Code:
<script type="text/javascript">
<!--
function validateForm(form) {
var $ErrNo=0;
var $form_object=document.forms.adminForm;
var $ErrStr = "";
if ($form_object.elements.LOname.value == -1 &&
$form_object.elements.LOaction.value == -1 &&
$form_object.elements.INup.value == -1 &&
$form_object.elements.Inaction.value == -1 ) {
$ErrNo=1;
$ErrStr = "You must make a selection\n"
}
if ($ErrNo != "0") {
alert ($ErrStr);
return false;
}
document.adminForm.submit();
}
// -->
</script>
The calling form is
Code:
form name="adminForm" action="admin3.cgi" method="post" onSubmit="return validateForm()">
<table border="0" cellpadding="4" cellspacing="2" align="center">
<tr>
<td valign="top"><b><font color="#552500">Loan Officers:</font></b></td>
<td valign="top" height="24">
<select name="LOname" size="1">
<option selected>Select</option>
<option value="LO1">LO1</option>
<option value="LO2">LO2</option>
</select>
</td>
<td valign="top" height="24">
<select name="LOaction" size="1">
/>
<option selected>Select</option>
<option value="Upload" label="Upload">Upload</option>
<option value="Delete" label="Delete">Delete</option>
<option value="Change Password" label="Change">Change Password</option>
</select>
<td valign="top" height="24"> </td>
</tr>
<tr>
<td valign="top"><b><font color="#552500">Investors:</font></b></td>
<td valign="top" height="24">
<select name="INup" size="1">
<option selected>Select</option>
<option value="JRC1">JRC1</option>
<option value="JRC2">JRC2</option>
<option value="JRC3">JRC3</option>
</select>
</td>
<td valign="top" height="24"><select name="Inaction" size="1">
/>
<option selected>Select</option>
<option value="Upload" label="Upload">Upload</option>
<option value="Delete" label="Delete">Delete</option>
<option value="Change Password" label="Change">Change Password</option>
</select>
</td>
<td valign="top" height="24"> </td>
</tr>
<tr>
<td valign="top" height="24"> </td>
<td valign="top" height="24"><input type="submit" name="submit" value="Submit" /></form></td>
<td valign="top" height="24"> </td>
</tr>
</table>
</form>
Any insights greatly appreciated.
Jim