This is a good first check, but I would never blindly trust any sort of
client-side data validation.  This is just inviting hackers to have a
field day.

Kevin

>>> [EMAIL PROTECTED] 12/15/00 03:04PM >>>
I agree with Joel.  Using JavaScript to process on the client side is
fast and doesn't need to hit the CF server.  I always
use this to check numeric value: ( I am sure many of you already know
how to do this, but I am posting it for those who
might not know.)
===========================
<script language="Javascript">
function checkfield()
{
  if  (isNaN(document.forms[0].phone.value))
   {alert ("Sorry, but you must enter a numeric value.")
   document.forms[0].phone.focus();
   return false;
   }
}
</script>
===================


Joel Firestone wrote:

> One way I found useful was to use JavaScript on the client-side
> to test if they were numbers or not. Then you know only numbers
> are being submitted.
>
> J
>
> : I am trying to do some server side validation for a phone number,
but I am
> running into an odd problem.  I split the phone number entry form
into three
> textboxes the first one for area code (ie must be 3 numbers) and then
the
> two parts of the phone number (ie must be 3 numbers and then must be
4
> numbers).  I check to make sure the length of each textbox is correct
and
> then I try to check if they are numeric, however it will throw an
error.
> :
> : My code looks something like this:
> :
> : <cfif not IsNumeric("attributes.custPhone1") or not
> IsNumeric("attributes.custPhone2") or not
> IsNumeric("attributes.custPhone3")>
> :     <cfset attributes.error = attributes.error & "Please enter a
valid
> phone number.<br>">
> : </cfif>
> :
> : The strange part is that when I take out the not IsNumeric()
statements
> for the first two form variables it works fine.  Ideas???
> :
> : -Greg
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to