This has always worked well for me:

First, I create a list variable containing all the relevant items returned
from the query.  This is the list of all categories associated with the
current user or whomever.

<CFSET CategoriesList = valueList(<QueryName>.Category_ID)>

Then, in my SELECT statement, I just embed a CFIF statement to determine
whether the current output (from a query pulling all categories) category is
contained within this user's categorylist variable.  If so, then add
SELECTED to the OPTION tag for this category.  If not, then just add
category to the list without pre-selecting it.

<SELECT NAME="<whatever>" SIZE="5" MULTIPLE>

<CFOUTPUT QUERY="<queryname>">
        <CFIF CategoriesList CONTAINS <QueryName>.Category_ID>
                <OPTION VALUE="#Category_ID#"
SELECTED>#<CategoryDescription>#</OPTION>
        <CFELSE>
                <OPTION
VALUE="#Category_ID#">#<CategoryDescription>#</OPTION>
        </CFIF>
</CFOUTPUT>

Jesse D. Roberts
Business Process Analyst
Procurement Quality Assurance
Boeing - Huntington Beach, CA
[EMAIL PROTECTED]
Ph. 714-896-3462
Fx. 714-896-3303

> -----Original Message-----
> From: Perez, Bismark [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, July 05, 2000 7:44 AM
> To:   Cf-Talk (E-mail)
> Subject:      DB normalization rules and multi-select
> 
> Hello there,
> 
> I have been wrestling with this problem with no success... I have two
> tables
> one contains the category types (category_id and description) and another
> all the categories assigned to a locale (locale_id and category_id)... on
> one of the forms I list all the categories for the user to select, it is
> been saved correctly (even when user selects multiple entries) the problem
> is when I try to redisplay the categories with the already assigned
> categories pre-selected, it is only selecting the first one, any ideas...
> 
> Bismarck Perez
> *1-617-563-2896
> * G10H
> * [EMAIL PROTECTED]
> 
> 
> --------------------------------------------------------------------------
> ----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to