Hi Richard,

If query.value is Boolean ( yes, no, 1, 0 ) then you can directly use it as
the value of checked see below:

<cfset query = structNew() />
<cfset query.value1 = "yes" />
<cfset query.value2 = "no" />
<cfset query.value3 = "1" />
<cfset query.value4 = "0" />

<cfform>
        <cfinput type="checkbox" name="field_name1"
checked="#query.value1#"> 
        <cfinput type="checkbox" name="field_name2"
checked="#query.value2#">
        <cfinput type="checkbox" name="field_name3"
checked="#query.value3#">
        <cfinput type="checkbox" name="field_name4"
checked="#query.value4#">
</cfform>

Paul K.

-----Original Message-----
From: Richard Lytle [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 17 July 2008 6:38 AM
To: CF-Newbie
Subject: Re: prepopulate cfform checkbox

>so you can conditionally just add "checked" like this:
>
><input type="checkbox" name="chbx" value="yes" <cfif query.value eq  
>"yes">checked</cfif>>
>

I tried this

<cfinput name="chbx" id="chbx" value="Yes" type="checkbox" <cfif query.value
eq "yes">checked</cfif> />

and it threw an error. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3840
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to