Christina,

The solution might be that in your 'selected' attribute on the <cfselect>
tag, you are specifying "#qdMcd.mcd#" which would only indicate ONE value.
If you want all the MCD's listed from the qdMCD query, then you need to put
selected="#valueList(qdMcd.mcd)#"

Dave

-----Original Message-----
From: Christina K [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 14, 2008 1:49 PM
To: cf-newbie
Subject: need a cfselect multiple="yes" where more than one value is
preselected

My apologies if this has already been posted. I'm at my wits end and can't
find anything in the forums to solve my problem.

I've created a cfform which has multiple modes (add, edit, view).  In this
form is a cfselect box where users can enter multiple communities which
their project spans.  In the edit mode, this box should still show the whole
list, and it should highlight (pre-select) all communities currently in the
database for that project.  I've got the code working so that the first
community from the table is selected, but not the rest.  I've tried looping
and a few other things but I'm stuck and my deadline is fast approaching...
any advice would be appreciated.  Thanks in advance!  

Here's the relevant code...

<cfquery name="qdMcd">
    SELECT mcd, tip_id
    FROM tip_mcd
    WHERE tip_id = #tip#
</cfquery>

<cfquery name="mcds">
  SELECT semmcd, mcd_name, county, 'Counties' AS cnty_name 
  FROM lu_semmcd
  WHERE semmcd IN (1998, 1999, 2999, 3999, 4999, 5999, 6999, 7999)
UNION
  SELECT semmcd, mcd_name, county, 'Communities' AS cnty_name 
  FROM lu_semmcd
  WHERE semmcd NOT IN (1998, 2073, 2172, 2252, 6142) AND semmcd < 8025 AND
semmcd NOT LIKE '%999'
  ORDER BY cnty_name DESC, mcd_name
</cfquery>

<cfselect name="mcd" id="mcd" size="3" query="mcds" group="cnty_name"
display="mcd_name" value="semmcd" selected="#qdMcd.mcd#"
queryPosition="below" required="yes" multiple="yes" message="You must select
at least one location."
onChange="" style="width:230px;"> 
   <option value="8999" >Southeast Michigan</option>
</cfselect> 



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

Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4045
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