RE: [ACFUG Discuss] isValid and validate="integer"

2009-03-04 Thread Charlie Arehart
I hear that you've moved on, and fair enough, but in case it helps others,
you said, "I did verify the form.fieldname output by observing what was
inserted to the database that it uses."

 

I would challenge that testing what got inserted into the DB would not be
proof of what I was asking for. The DB could have permitted/converted the
number to something different than what came in. I meant to assert that you
test exactly what is coming from the form (because you were referring to an
isvalid test in CFML).

 

I see that you also now refer to CF's client-side validation, because you
looked into the js file it uses. Again, fair enough. All different things.

 

As for the scenario I mentioned above, with some DBs a currency format will
accept entries with or without a $, but what it stores internally obviously
is just a number. This may well be part of the confusion you're seeing, if
some validation methods had to accomadate this factor. 

 

Just sharing thoughts from a brain to be "picked". :-)

 

/charlie

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Troy Jones
Sent: Wednesday, March 04, 2009 2:55 PM
To: discussion@acfug.org
Subject: RE: [ACFUG Discuss] isValid and validate="integer"

 

For now, I have implemented a server side workaround to fix the issue using
REreplace(). It just seemed inconsistent to me that "integer" would not
validate only "integral" data.

 

Charlie,

 

I did verify the form.fieldname output by observing what was inserted to the
database that it uses. It did indeed have the "$" character in the data.
What I was looking into and wasn't able to come to a good enough conclusion
to determine anything was the /inetpub/wwwroot/cfide cfform.js. It appeared
that the _cf_checkinteger() function was actually stripping the "$"
character before providing a return value. I also found that confusing.
Isn't the point of determining a data type to see if it is actually that
data type and not strip it and manipulate it first? Maybe this is where I am
missing the boat, if indeed I am missing the boat.

 

Anyways, like I said, I have moved on with my own workaround for now. I was
really just picking brains for experience on the matter.

 

 

Troy Jones

Dynapp Support Team

678-528-2952 




-
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-



RE: [ACFUG Discuss] isValid and validate="integer"

2009-03-04 Thread Troy Jones
For now, I have implemented a server side workaround to fix the issue
using REreplace(). It just seemed inconsistent to me that "integer"
would not validate only "integral" data.

 

Charlie,

 

I did verify the form.fieldname output by observing what was inserted to
the database that it uses. It did indeed have the "$" character in the
data. What I was looking into and wasn't able to come to a good enough
conclusion to determine anything was the /inetpub/wwwroot/cfide
cfform.js. It appeared that the _cf_checkinteger() function was actually
stripping the "$" character before providing a return value. I also
found that confusing. Isn't the point of determining a data type to see
if it is actually that data type and not strip it and manipulate it
first? Maybe this is where I am missing the boat, if indeed I am missing
the boat.

 

Anyways, like I said, I have moved on with my own workaround for now. I
was really just picking brains for experience on the matter.

 

 

Troy Jones

Dynapp Support Team

678-528-2952

 

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Charlie
Arehart
Sent: Wednesday, March 04, 2009 1:57 PM
To: discussion@acfug.org
Subject: RE: [ACFUG Discuss] isValid and validate="integer"

 

Troy, when you were validating the form, did you by any chance use the
validate="onserver" attribute (if it was a CFFORM) or the older hidden
field validation where you used name="yourfield_integer" for a hidden
field? If so, both of those could be changing the actual value coming
into the form processing page, so that the $ is gone. Just be sure to
output the value of form.fieldname before your isvalid test, to be sure
it's indeed what you expect it should be. 

 

There's a problem similar to this that happens with date fields, where
the date typed in becomes an ODBC date format unexpectedly (something I
blogged about many years ago:
http://www.systemanage.com/cff/cftips3.cfm#_date).

 

If that's not it, please do let us know. Just something I thought worth
your double-checking.

 

/charlie

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Troy Jones
Sent: Wednesday, March 04, 2009 12:45 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] isValid and validate="integer"

 

Hey again all,

 

I was working on a form that is using a  tag with the attribute
of "validate="integer"". In testing this form, I was using all types of
different characters trying to get it to blow up and every single time I
used the "$" character and only numbers besides, it would return true
and allow submission. That seemed a little odd to me. I had always
understood "validate="integer"" to mean that the data should contain
only numbers. "$" is certainly not a number.

 

So, I wanted to try another method of validation. I created a test
template and used the isValid("integer", "testvaluehere") function with
the same data that I had been testing with on the bugged form. Lo and
behold, it also returned true with the "$" character in the data.
However, when using the isNumeric() function, it returned false as
expected.

 

Has anyone else ever encountered this or does anyone have any input on
this? Is this a known bug?

 

Troy Jones

Dynapp Support Team

678-528-2952

 

 


- 
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform 

For more info, see http://www.acfug.org/mailinglists 
Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
List hosted by FusionLink <http://www.fusionlink.com>  
- 


- 
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform 

For more info, see http://www.acfug.org/mailinglists 
Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
List hosted by FusionLink <http://www.fusionlink.com>  
- 




-

To unsubscribe from this list, manage your profile @ 

http://www.acfug.org?fa=login.edituserform



For more info, see http://www.acfug.org/mailinglists

Archive @ http://www.mail-archive.com/discussion%40acfug.org/

List hosted by http://www.fusionlink.com

-




RE: [ACFUG Discuss] isValid and validate="integer"

2009-03-04 Thread Charlie Arehart
Troy, when you were validating the form, did you by any chance use the
validate="onserver" attribute (if it was a CFFORM) or the older hidden field
validation where you used name="yourfield_integer" for a hidden field? If
so, both of those could be changing the actual value coming into the form
processing page, so that the $ is gone. Just be sure to output the value of
form.fieldname before your isvalid test, to be sure it's indeed what you
expect it should be. 

 

There's a problem similar to this that happens with date fields, where the
date typed in becomes an ODBC date format unexpectedly (something I blogged
about many years ago: http://www.systemanage.com/cff/cftips3.cfm#_date).

 

If that's not it, please do let us know. Just something I thought worth your
double-checking.

 

/charlie

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Troy Jones
Sent: Wednesday, March 04, 2009 12:45 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] isValid and validate="integer"

 

Hey again all,

 

I was working on a form that is using a  tag with the attribute of
"validate="integer"". In testing this form, I was using all types of
different characters trying to get it to blow up and every single time I
used the "$" character and only numbers besides, it would return true and
allow submission. That seemed a little odd to me. I had always understood
"validate="integer"" to mean that the data should contain only numbers. "$"
is certainly not a number.

 

So, I wanted to try another method of validation. I created a test template
and used the isValid("integer", "testvaluehere") function with the same data
that I had been testing with on the bugged form. Lo and behold, it also
returned true with the "$" character in the data. However, when using the
isNumeric() function, it returned false as expected.

 

Has anyone else ever encountered this or does anyone have any input on this?
Is this a known bug?

 

Troy Jones

Dynapp Support Team

678-528-2952

 

 


- 
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform 

For more info, see http://www.acfug.org/mailinglists 
Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
List hosted by FusionLink   
- 




-
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-



Re: [ACFUG Discuss] isValid and validate="integer"

2009-03-04 Thread Teddy R. Payne
Troy,
I am not sure I would say this a case for a bug report.  It seems like what
you are trying to compare is the representation of an integer in the context
of a string versus teh representation of a integer in context of a number.

As ColdFusion has dynamic data types, $100 as a currency is a integer value
from the perspective of the value, but not from the perspective of the
characters represented in the string.

If you are specifically trying to exclude the dollar sign, it seems a more
string approach to your value is needed like isNumeric() or using a Regular
Expression validation.  If you want to preserve the number itself as a data
type expression, you could use NumberFormat() and apply a mask that
represents the numerical data type according to your needs.

If you want to test for the presence of only numbers with the paradigm of a
string literal:



It is how you look at it and your style preference.  The functions you have
referenced gives options to developers to allow them to interpret.

Teddy

Caveat - My regular expression was a simple greedy case.  Please customize
to your needs.