Pete Freitag Pete Freitag

IsValid - CFMX 7

Updated on November 14, 2023
By Pete Freitag

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!
	Invalid Integer!

For a range:

<cfif IsValid("range", url.value, 1, 100)>
	Value is between 1 and 100
	Value is not between 1 and 100

And for regular expressions:

<cfif IsValid("regex", url.value, "[A-Z][a-z]+")>
	Word starts with a capital letter
	Word does not match pattern.

isvalid coldfusion 7 cfml

IsValid - CFMX 7 was first published on February 10, 2005.

If you like reading about isvalid, coldfusion 7, or cfml then you might also like:

FuseGuard Web App Firewall for ColdFusion

The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.

The weekly newsletter for the CFML Community


Hmm - according to the docs - the regex is a JS regex, not a CF regex. Anyone know why?
by Raymond Camden on 02/10/2005 at 9:35:42 PM UTC
According to Ray's post on his blog, it does infact use CF Regex.
by Pete Freitag on 02/11/2005 at 5:30:05 PM UTC