Pages

Wednesday, December 4, 2013

How to Restrict Input to Numeric Only in ColdFusion

Ensuring the quality of data passed to and from a database is a cornerstone of any platform of dynamic Web development, and Adobe's ColdFusion platform is no exception. Fortunately, later versions of the ColdFusion environment contain a parameter for use in tags known as validate, with which you can ensure any number of rules that must be adhered to in order for the form to be properly processed. This includes requiring that the variable be composed entirely of numbers.

Instructions

    1

    Open the page containing the form you wish to validate. Move your cursor to the tag for which you wish to add a validation rule.

    2

    Add the following parameter to the tag:

    validate="numeric"

    3

    Save and publish your page. Your form will now fail to process if its value contains anything other than a numeric value.

0 comments:

Post a Comment