5 Replies Latest reply on Sep 22, 2015 9:54 AM by Steve Sommers

    CFINPUT VALIDATE INTEGER NOT WORKING PROPERLY

    jackhuang Level 1

      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.