> I just find it weird that isValid("integer") would consider $123,123
> as a valid integer value....such that I have to fix it in the first place!

I agree that seems a little wonky.  I ran the code below to test some
values with ColdFusion 9 and the results are included in the inline
comments:

<cfoutput>
        $123,123.00 = #isvalid("integer", "$123,123.00")# <!--- NO ---> <br>
        123,123.00 = #isvalid("integer", "123,123.00")# <!--- NO ---> <br>
        123,123 = #isvalid("integer", "123,123")# <!--- YES ---> <br>
        $123,123 = #isvalid("integer", "$123,123")# <!--- YES ---> <br>
        4,123,123 = #isvalid("integer", "4,123,123")# <!--- YES ---> <br>
        4,123,123,123 = #isvalid("integer", "4,123,123,123")# <!--- NO ---> <br>
        123,,123 = #isvalid("integer", "123,,123")# <!--- YES ---> <br>
</cfoutput>

It will accept the dollar sign ("$") and even a double comma (",,") as
part of an integer value, but not a decimal point (".00").  I can see
how that would be frustrating as I would expect it to handle some of
those differently.  I've been sanitizing integers on my own since
ColdFusion 4, so this isn't something I've really bumped into.  I do
use isValid() for verifying e-mail address formats in some places, so
I'm beginning to wonder what problems exist in that algorithm, if any.
 Hmm...


-Justin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350784
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to