User Guide

Chapter 2: ColdFusion Functions 391
IsBoolean
Returns TRUE if value can be converted to a Boolean; otherwise, FALSE.
See also IsNumeric and YesNoFormat.
Syntax IsBoolean(
value
)
value
Any number or string.
Examples <!--- This example shows the use of IsBoolean --->
<HTML>
<HEAD>
<TITLE>
IsBoolean Example
</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<H3>IsBoolean Example</H3>
<CFIF IsDefined("FORM.theTestValue")>
<CFIF IsBoolean(FORM.theTestValue)>
<H3>The expression <CFOUTPUT>#DE(FORM.theTestValue)#</CFOUTPUT>
is Boolean</H3>
<CFELSE>
<H3>The expression <CFOUTPUT>#DE(FORM.theTestValue)#</CFOUTPUT>
is not Boolean</H3>
</CFIF>
</CFIF>
<FORM ACTION="isBoolean.cfm" METHOD="POST">
<P>Enter an expression, and discover if
it can be evaluated to a Boolean value.
<INPUT TYPE="Text" NAME="TheTestValue" VALUE="1">
<INPUT TYPE="Submit" VALUE="Is it Boolean?" NAME="">
</FORM>
</BODY>
</HTML>