IsBoolean

Description

Determines whether a value can be converted to Boolean

Returns

True, if the parameter can be converted to Boolean; False, otherwise.

Function syntax

IsBoolean(value)

Parameters

Parameter

Description

value

Number or string

Example

<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"> 
<p>Enter an expression, and discover whether it can be evaluated to a 
    Boolean value. 
 
<input type = "Text" name = "TheTestValue" value = "1"> 
<input type = "Submit" value = "Is it Boolean?" name = ""> 
</form>