Dynamic Multiple selection lists
Hi: I wanted to make some sort of search for my website that has check boxes. They look very very clean and easy to use for most users. I found a great help in (http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/formatData7.htm) I write down some parts of the tutorial to ask my question. * input type=checkbox name=SelectedDepts value=Training Trainingbr input type=checkbox name=SelectedDepts value=Marketing Marketingbr input type=checkbox name=SelectedDepts value=HR HRbr input type=checkbox name=SelectedDepts value=Sales Salesbr 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,')#) 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? Thanks Benign ~| Check out the new features and enhancements in the latest product release - download the What's New PDF now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293762 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Dynamic Multiple selection lists
Ali Majdzadeh wrote: http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/formatData7.htm input type=checkbox name=SelectedDepts value=Training Trainingbr 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