In the following code the user can avoid filling in the Given name field by first filling in the Family name field and then
clicking twice outside the Given name field. How should I modify the script so that the user can choose what field
to begin with but is forced to end with both fields completed?
Thanks,
Liglin
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
function ValidateTextFields(){
if (TheForm.GivenName.value=='') {
alert('Please fill in your given name.');
TheForm.GivenName.focus();
}
else if (TheForm.FamilyName.value=='') {
alert('Please fill in your family name.');
TheForm.FamilyName.focus();
}
}
//-->
</SCRIPT>
</HEAD>
<BODY bgcolor="E4E4E4" onLoad="javascript:TheForm.GivenName.focus();">
<FORM name="TheForm" method="post" action="delme.htm">
<P>Given name: <INPUT type="text" name="GivenName" >
Family name: <INPUT type="text" name="FamilyName" onBlur="ValidateTextFields();">
</P>
</FORM>
</BODY>
</HTML>
clicking twice outside the Given name field. How should I modify the script so that the user can choose what field
to begin with but is forced to end with both fields completed?
Thanks,
Liglin
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
function ValidateTextFields(){
if (TheForm.GivenName.value=='') {
alert('Please fill in your given name.');
TheForm.GivenName.focus();
}
else if (TheForm.FamilyName.value=='') {
alert('Please fill in your family name.');
TheForm.FamilyName.focus();
}
}
//-->
</SCRIPT>
</HEAD>
<BODY bgcolor="E4E4E4" onLoad="javascript:TheForm.GivenName.focus();">
<FORM name="TheForm" method="post" action="delme.htm">
<P>Given name: <INPUT type="text" name="GivenName" >
Family name: <INPUT type="text" name="FamilyName" onBlur="ValidateTextFields();">
</P>
</FORM>
</BODY>
</HTML>