Checkboxes are odd, this is not a CF issue but an html issue.  The  
value is always what you want when it is checked.  You must also add  
"checked" in there like this:

....name="name" value="yes" checked>

so you can conditionally just add "checked" like this:

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

Have fun :)


On Jul 16, 2008, at 3:39 PM, Richard Lytle wrote:

> Hi,
>
> I'm trying to "prepopulate" a checkbox based on the value returned  
> by a database query.  I want the box checked if the query value is  
> "Yes", unchecked otherwise.
>
> <label for="chbx">Name</label>
>  <cfif query.value eq "Yes">
>    <cfinput name="chbx" id="chbx" type="checkbox"  
> value="Yes"checked="yes" required="no" size="30" />
>   <cfelse>
>      <cfinput name="chbx" id="chbx" type="checkbox" value="Yes"  
> required="no" size="30" />
>   </cfif>
>
> So far no matter what conditions I set every check box is created  
> checked.
> Appreciate any help or ideas.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:3837
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