Hello, all. I am trying to do some form validation, but it isn't
working. Instead of giving me the alert, it takes me to the action page,
no matter what I type in. I basically took this code straight from a
book. Any ideas? Thanks.
<html>
<head>
<script language="JavaScript">
<!---
function checkForm() {
var ValidPassed = True;
while (ValidPassed==True) {
if (!document.fBuyout.varFname.value.length) {
alert("Enter First Name.");
document.fBuyout.varFname.focus();
ValidPassed=false;
break;
}
break;
}
Return ValidPassed;
}
// --->
</script>
</head>
<body>
<cfoutput>
<cfform action="buyoutaddaction.cfm" method="post"
name="fBuyout" onSubmit="return checkForm()">
<table>
<tr>
<td>
<cfinput type="text" name="varFname"
size="10" maxlength="10" value="">
</td>
<td>
<input type="Submit" value="ok">
</td>
</tr>
</table>
</cfform>
</cfoutput>
</body>
</html>
Chris King
Desktop Support Specialist / Winbatch Guru
Atos Origin
301 University Blvd
1.710 Rebecca Sealy
Galveston, TX 77555
USA
Phone : 409.747.9428
Fax : 409.747.9569
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.atosorigin.com
"Never test for an error you don't know how to handle."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1318
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54