Quantcast
Channel: Adobe Community : Popular Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 14291

CFINPUT VALIDATE INTEGER NOT WORKING PROPERLY

$
0
0

The CFINPUT with the VALIDATE="integer" is not working properly at all.  The user can enter 23,950 as the number.  We would think this is OK but it won't work properly without stripping the ","

 

The field:

<CFINPUT TYPE="text" NAME="mynumber" VALIDATE="integer" MESSAGE="mynumber must be an integer">

 

Then, when the value is passed to the SQL INSERT

<CFQUERY....>

INSERT INTO mytable

(name, mynumber)

VALUES

(#'form.name#',#form.mynumber#)

</CFQUERY>

 

Coldfusion will take the value 23,950 and think that 23 is one field and 950 is another because of the ","   Therefore it is trying to put 3 values into 2 fields and throw an error.  Am I doing something wrong here or is this Coldfusion bug?

 

p.s. in the MySql database, the "mynumber" field is defined as integer.


Viewing all articles
Browse latest Browse all 14291

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>