Accessibility

TechNote

cfinput tag does not validate integers properly (ColdFusion)

Issue


Using cfinput set with validate="integer" allows the dollar symbol ($) to bypass the client side validation.

Solution


To workaround this issue, you mustvalidate that only true integers are entered into a cfinput by using validate="regex" with a pattern="^[0-9]*$" instead of using the validate="integer" attribute. For example:

 <cfinput
		
type="text"
name="myInt"
validate="regex"
pattern="^[0-9]*$"
message="Please enter only valid integers!"
validateAt="onSubmit">

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:kb406841

Products Affected:

coldfusion