Just found this nice little feature, which is basically undocumented..
There are two Form helpers for drop down select boxes in CfWheels – one is the standard selectTag(), and the other is select() which will bind itself to an object automatically. The selectTag() function is just designed for bog standard forms with no object property.
In CfWheels, you can pass normal HTML attributes into the form helpers, like ‘id’, ‘class’ etc.. these are largely undocumented in the CfWheels docs, as they’re well, fairly obvious.
What I’ve just found, which plesantly surprised me, is that you can pass ‘multiple=true’ into the select() form helper, and if the corresponding object’s value is a comma deliminated list, it automatically puts in the necessary markers for it to be selected: this is one step up from the standard logic of just passing through the attribute, as CfWheels seems to be doing conditional statements to determine whether it’s selected or not. Nice.
So with the following (with the options ‘allBlocks’ being a query of available blocks):
#select(objectName="page", multiple='true', label="Prepend to Content", property="prepend_blockid", options=allBlocks)#
If in my object ‘page’, page.prepend_blockid = ’1,4,5,6,7′, then wheels will automatically give me
<select id=“page-prepend_blockid” multiple=“multiple” name=“page[prepend_blockid]“> <option value=“”></option> <option selected=“selected” value=“1″>About Menu Block</option> <option value=“2″>About Us Quick Text</option> <option value=“3″>Site Information Menu</option> <option selected=“selected” value=“4″>What We Do Menu Block</option> <option selected=“selected” value=“5″>Google Search Form</option> <option selected=“selected” value=“6″>Contact Form</option> <option selected=“selected” value=“7″>Twitter Update</option> <option value=“8″>Resources Menu</option> <option value=“9″>Latest 5 Webcasts</option> <option value=“10″>Latest 5 Podcasts</option> </select>