OK.  I have another application where I do in fact use a table for the
lookup.  I've tried to use your example and apply it here.  But nothing is
selected.  My code is as follows:

<cfquery datasource="FirmDirectory" name="EditNameQry">
Select * from Employees where ID='#EditGrid.ID#'
</cfquery>

<cfquery datasource="FirmDirectory" name="GetPG">
Select * from PracticeGroups order by PG
</cfquery>

        <cfselect name="NewPG" size="3" multiple>
                        <CFLoop query="GetPG">
                        <CFIF
ListContains(GetPG.PG,#EditNameQry.PracticeGroup#)>
                        <CFSET PGSelected = "Selected">
                        <CFELSE>
                <CFSET PGSelected = "">
                        </cfif>
                        <Option #PGSelected#
value="#PG#"><cfoutput>#PG#</cfoutput></option>
                        </cfloop>
                </cfselect>

Note that if I replace the :  <CFIF
ListContains(GetPG.PG,#EditNameQry.PracticeGroup#)>
with:  <CFIF ListContains(GetPG.PG,"Agribusiness")>

Then Agribusiness is in fact selected.  So I'm assuming there's something
wrong with that one line.  Do you happen to see where I went wrong? 

TIA,

Athelene 

-----Original Message-----
From: Mark Armendariz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 08, 2000 7:44 AM
To: [EMAIL PROTECTED]
Subject: RE: Multiple value Select


I did this sort of thing for an intranet i'm working on with selected
company newsgroups... The best way to do it is with a database of your
finance types.  This will allow you to updae the select statement without
changing the hard coding.  So the form will always be right.  Query that
database and the user database.  In the user database, you will want to save
a comma delimited list of the finance types they are assigned for.  When you
bring up the select, you can scroll through all the finance types, and if
the user had any in his/her list, they will set the FinanceSelected variable
to 'selected.'  if they're not in the list, FinanceSelected will be blank.

Hope this helps...

<CFQuery Name="GetFinances" datasource="#Application.datasource#">
  SELECT        FinanceName
  FROM  tblFinances
  ORDER By      FinanceName
</CFQuery>

<CFQuery Name="GetCustomer" datasource="#Application.datasource#">
  SELECT        CustomerName,
                Address,
                Finances        <!--- This Field is a comma delimited list
of the user's
finances --->
  FROM  tblCustomers
  WHERE CustomerID = #Attributes.CustomerID#
</cfgquery>


Finances:<br>

<Select Name="Finances" size="#GetFinances.RecordCount#" multiple>
  <CFLoop query="Finances">
    <CFIF ListContains(GetCustomer.Finances,#FinanceName#)>
      <CFSET FinanceSelected = "Selected">
    <CFELSE>
      <CFSET FinanceSelected = "">
    </cfif>
    <Option #FiannceSelected# value="#FinanceName#">#FinanceName#</option>
  </cfloop>
</select>



Mark Armendariz
Righteous Design
www.sorighteous.com
[EMAIL PROTECTED]


-----Original Message-----
From: Gieseman, Athelene [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 07, 2000 6:34 PM
To: [EMAIL PROTECTED]
Subject: Multiple value Select


I'm trying to set up a CFSELECT using the SELECTED option.  I need to have
the CFSELECT set up as multiple since more than one option is permitted.
However, I can never seem to get the SELECTED option to properly highlight
the options that are already stored in the record.  (In other words, I want
to create an edit screen where the previously stored values are preselected
in this control.)  Any thoughts on what I may be doing wrong?  The code for
my select follows:  (Note that ViewGrid is a grid from which the user
previously selected this record.  I've also tried doing this from a query
with the same result - nothing is selected.)

<cfselect name="FinanceType" size="2" selected="#ViewGrid.FinanceType#"
multiple>
<option value="Single Family Housing">Single Family Housing</option>
<option value="501(c)(3)">501(c)(3)</option>
<option value="Hospital Revenue">Hospital Revenue</option>
<option value="Leasehold Revenue">Leasehold Revenue</option>
<option value="Multifamily Housing">Multifamily Housing</option>
<option value="General Obligation">General Obligation</option>
<option value="NID">NID</option>
<option value="Special Obligation">Special Obligation</option>
<option value="Industrial Development">Industrial Development</option>
<option value="TIF">TIF</option>
<option value="TDD/TC">TDD/TC</option>
<option value="Other">Other</option>
</cfselect>
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
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/cf-talk@houseoffusion.com/
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/cf-talk@houseoffusion.com/
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