B
barney
I'm wondering if I can use JS to forcibly empty a form field (sorry if
this is an FAQ - I can't find much reference to it in the group via a
quick Google search, and the one solution I did locate doesn't seem to
work).
The relevant bits of the form and script are below. The alert when the
contents of the two fields don't match DOES work, as does the focus on
the field NewPassword, but I would like if possible to empty the fields
NewPassword and NewPasswordAgain when they don't match.
<SCRIPT language="JavaScript" type="text/javascript">
<!--
function checkData()
{
var f = document.forms["new_entry"]
if(!(f.NewPassword.value == f.NewPasswordAgain.value))
{
alert("The two entries of your password didn't match.");
f.NewPassword.value == ''";
f.NewPasswordAgain.value == "'';
f.NewPassword.focus();
return false;
}
return true;
}
//-->
<FORM name="new_entry" method="GET" action="submit_company.asp"
target="_self" onSubmit="return checkData();">
<P>Choose a password of five to ten characters.</P>
<INPUT type="text" size="10" maxlength="10" class="visibletextinput"
name="NewPassword">
<BR>
<P>Re-enter password:</P>
<INPUT type="text" size="10" maxlength="10" class="visibletextinput"
name="NewPasswordAgain">
<BR><BR>
<INPUT type="submit" class="submitsmall" value="continue">
</FORM>
this is an FAQ - I can't find much reference to it in the group via a
quick Google search, and the one solution I did locate doesn't seem to
work).
The relevant bits of the form and script are below. The alert when the
contents of the two fields don't match DOES work, as does the focus on
the field NewPassword, but I would like if possible to empty the fields
NewPassword and NewPasswordAgain when they don't match.
<SCRIPT language="JavaScript" type="text/javascript">
<!--
function checkData()
{
var f = document.forms["new_entry"]
if(!(f.NewPassword.value == f.NewPasswordAgain.value))
{
alert("The two entries of your password didn't match.");
f.NewPassword.value == ''";
f.NewPasswordAgain.value == "'';
f.NewPassword.focus();
return false;
}
return true;
}
//-->
<FORM name="new_entry" method="GET" action="submit_company.asp"
target="_self" onSubmit="return checkData();">
<P>Choose a password of five to ten characters.</P>
<INPUT type="text" size="10" maxlength="10" class="visibletextinput"
name="NewPassword">
<BR>
<P>Re-enter password:</P>
<INPUT type="text" size="10" maxlength="10" class="visibletextinput"
name="NewPasswordAgain">
<BR><BR>
<INPUT type="submit" class="submitsmall" value="continue">
</FORM>