IsNumeric Function

2000-12-15 Thread Greg Wolfinger

Hey Guys/Gurls:

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



RE: IsNumeric Function

2000-12-15 Thread Dan Haley

Functions like isDefined, evaluate, and setVariable use quotes around the
variable name because you are sending them a variable _name_ to be
processed.  IsNumeric is being passed a _value_ to be processed, so
therefore shouldn't have the quotes around the variable name.  In your code
the isNumeric function is processing a string of "attributes.custPhone1"
rather than the value of the variable attributes.custPhone1.

Or so I understand it to be . . . :^)

Dan

-Original Message-
From: Greg Wolfinger [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 15, 2000 8:36 AM
To: CF-Talk
Subject: IsNumeric Function


Hey Guys/Gurls:

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



RE: IsNumeric Function

2000-12-15 Thread Patricia Lee

What does your error say?

 -Original Message-
 From: Greg Wolfinger [mailto:[EMAIL PROTECTED]]
 Sent: Friday, December 15, 2000 11:36 AM
 To: CF-Talk
 Subject: IsNumeric Function
 
 
 Hey Guys/Gurls:
 
 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



Fw: IsNumeric Function

2000-12-15 Thread Bill Davidson

Maybe its a operator precedence problem.  Try doing if (IsNumeric(...) is
false) or (...)  or (...).

-Bill
/intraget
- Original Message -
From: Greg Wolfinger [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Friday, December 15, 2000 11:36 AM
Subject: IsNumeric Function


 Hey Guys/Gurls:

 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



Re: IsNumeric Function

2000-12-15 Thread Jamie Keane

You shouldn't need the quotation marks around the parameter passed to
IsNumeric().  Try that.

--
Jamie Keane
Programmer
SolutionMasters, Inc.
9111 Monroe Rd., Suite 100
Charlotte, NC  28270
www.solutionmasters.com
704.563.5559 x 228  Voice
704.849.9291  Fax
-Original Message-
From: Greg Wolfinger [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Date: Friday, December 15, 2000 12:28 PM
Subject: IsNumeric Function


Hey Guys/Gurls:

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



Re: IsNumeric Function

2000-12-15 Thread Greg Wolfinger

Partricia:

When I said "throw an error" I meant it will set my attributes.error var to
"Please enter a valid phone number", meaning that the if statment I wrote
was true.  I figured out the problem though, it was because I was using
quotes, however, I'm not sure why the third variable worked with the quotes
around the variable name.

-Greg
- Original Message -
From: "Patricia Lee" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Friday, December 15, 2000 12:41 PM
Subject: RE: IsNumeric Function


 What does your error say?

  -Original Message-
  From: Greg Wolfinger [mailto:[EMAIL PROTECTED]]
  Sent: Friday, December 15, 2000 11:36 AM
  To: CF-Talk
  Subject: IsNumeric Function
 
 
  Hey Guys/Gurls:
 
  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



Re: IsNumeric Function

2000-12-15 Thread Joel Firestone

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



Re: IsNumeric Function

2000-12-15 Thread Greg Wolfinger

 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.

Yeh Joel, I am also doing JS validation, but if someone who is trying to
hack the site disables their javascript or is someone just doesnt have a js
browser and enters incorrect info, then I am in trouble.  The server side is
sort of a back-up validation, just in case.  Thanks for the tip though.

-greg
- Original Message -
From: "Joel Firestone" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Friday, December 15, 2000 2:09 PM
Subject: Re: IsNumeric Function


 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



Re: IsNumeric Function

2000-12-15 Thread Gilles Ratté

You should use javascript client-side script to validate the datas before
submitting.
You can use something like this :

if (document.formname.inputname.length == 3 
isNaN(document.formname.inputname.value)
{
alert('Invalid');
}

- Original Message -
From: "Joel Firestone" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Friday, December 15, 2000 2:09 PM
Subject: Re: IsNumeric Function


 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



Re: IsNumeric Function

2000-12-15 Thread Nathan Chen

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



Re: IsNumeric Function

2000-12-15 Thread Kevin Miller


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