IsValid - CFMX 7 Little Things
ColdFusion MX 7 added a new function called IsValid. The IsValid function performs data validation just like the
CFPARAM tag, and supports all the new data types in cfparam (see my previous post) as well.
For instance if we want to validate the a variable has an integer value:
<cfif IsValid("integer", url.value)> Valid integer! <cfelse> Invalid Integer! </cfif>
For a range:
<cfif IsValid("range", url.value, 1, 100)> Value is between 1 and 100 <cfelse> Value is not between 1 and 100 </cfif>
And for regular expressions:
<cfif IsValid("regex", url.value, "[A-Z][a-z]+")> Word starts with a capital letter <cfelse> Word does not match pattern. </cfif>
Like this? Follow me ↯Tweet Follow @pfreitag
IsValid - CFMX 7 Little Things was first published on February 10, 2005.
If you like reading about isvalid, coldfusion 7, or cfml then you might also like:
- Top 10 Underrated Functions in ColdFusion
- CFFUNCTION and CFARGUMENT don't support new types in ColdFusion 7
- Strong Encryption Technote shows undocumented features
- CFTIMER - Little things in ColdFusion 7
- cfdirectory adds recursive support - Little Things in CFMX 7
- ColdFusion 7 Strong Encryption
- CFPARAM - New Features in CFMX 7
The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.