Stephen i have used the following function:
<script language="JavaScript">
function check_numeric()
{
if (isNaN(document.forms[0].test.value))
{
alert("Please enter a Numeric Value");
return false;
}
else{
return true;
}
}
</script>
and then the textbox:
<input type="text" name="test" align="middle" size="10" maxlength="20"
value="#Numerical#" style="background-color:ccff00;
color:444444;font-type:arial;" onblur="check_numeric(this);">
However when i enter a numeric value it comes up with the error as well?
Could you enlighten me.
Many Thanks
Jerry
-----Original Message-----
From: Stephen Moretti [mailto:[EMAIL PROTECTED]]
Sent: 05 July 2001 09:23
To: CF-Talk
Subject: RE: Data Validation
Jerry,
> Could anyone inform me of the best javascript function to validate
a
> textbox, so that only a number can be entered.
>
The JS function you are after is : isNaN()
Its actually "is not a number". So you need to do something like :
if (isNaN(document.myform.myfield.value)) {
alert("You did not enter a number");
return false;
}
Hope this helps
Regards
Stephen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists