Ali Majdzadeh wrote:
http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/formatData7.htm
> <input type="checkbox"
>   name="SelectedDepts"
>   value="Training">
>   Training<br>

> In the livedoc the values weren't set dynamicly. Is it possible that the 
> SelectDepts reads from a db table? I mean that the checkboxes come from a 
> database table, is it possible?

<cfquery name="allDepts" ...>
   SELECT deptID, deptName FROM department
</cfquery>
<cfoutput query="allDepts">
<input type="checkbox"
   name="SelectedDepts"
   value="#allDepts.deptID#"
   id="cb#allDepts.deptID#"
   >
   <label for="cb#allDepts.deptID#">
     #allDepts.deptName#
   </label>
</cfoutput>


> If the user checked Marketing and Sales, the value of the SelectedDepts form 
> field would be the list Marketing,Sales and you use the following SQL 
> statement: 
> 
> SELECT *
>   FROM Departmt
>   WHERE Dept_Name IN
>   (#ListQualify(Form.SelectedDepts,"'")#)

Use cfqueryparam with the list attribute:

<cfquery name="selectedDepts" ...>
   SELECT *
   FROM Departmt
   WHERE deptID IN
   (<cfqueryparam list="true" value="#Form.SelectedDepts#" 
cfsqltype="cf_sql_integer">)
</cfquery>

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293763
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to