I'm tring to use a validation function example from WROX that looks at
form fields on a submit. I can't seem to launch it. I have 2 other
functions up in the header that work fine. Any help appreciated. Here is
the code and form:
<script type='text/javascript'>
function form1_onsubmit( )
{
var form = document.MyInpu t
var controlCounter;
var returnValue = true;
var formControl;
for controlCounter = 0; controlCounter < form.length; controlCounter+ +)
{
formControl = form.elements[controlCounter];
if (formControl.ty pe == "text" && formControl.val ue =="")
{
alert("Please complete all fields");
formControl.foc us();
returnValue = false;
break;
}
}
return returnValue;
}
</script>
</head>
<Table border="1" Width=100%>
<form action="MyInser t.asp" method="Post" name="MyInput"
LANGUAGE=JavaSc ript onsubmit="retur n form1_onsubmit( )">
<TR>
<td width=20%><inpu t type="TEXT" name="ExDate2" onkeypress="if
(event.keyCode == 13)
{document.getEl ementById('next ').focus();retu rn
false;}"> </td>
<td width=20%><SELE CT name="Expense2" id="next" onkeypress="if
(event.keyCode == 13)
{document.getEl ementById('next 2').focus();ret urn
false;}"onchang e='javascript:T itleonchange(); '><Option value="Select"
Selected>
<Option Value="Car">Car
<Option Value="Meals">M eals
<Option Value="Air">Air
<Option Value="Phone">P hone</select> </td>
<td width=20%><inpu t type="INPUT" READONLY=TRUE
name="ExCode2"> </td>
<td width=20%><inpu t type="TEXT" id="next2" name="Amount2"> </td>
<td width=20%><inpu t type="SUBMIT" value="Submit"> </td>
</tr>
</table>
thanks,
Frank
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!