This may be a stupid question but the query EditNameQry is only pulling one
value for PracticeGroup.  Right?  If not I'm sure that when you "view
source" you'll see that more than one option is "SELECTED".  That will
confuse the browser and it will stay on the first option.

--K

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


Yo may have a point.. try putting quotes around EditNameQry.PracticeGroup.

Plus, if I replace

            <CFIF ListContains(GetPG.PG,EditNameQry.PracticeGroup)>
with

            <CFIF ListContains(GetPG.PG,"Agribusiness")>

the Agribusiness option is selected.  So I think I'm doing something wrong
in how I'm using the second parameter of the ListContains.

-----Original Message-----
From: Gieseman, Athelene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 08, 2000 4:18 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Multiple value Select


No luck.  I think there's a problem in that the listcontains isn't finding
any matches.  I can't figure out why.  I display the previously selected
items in another part of the form and it is identical to the options in the
database.  There is a comma separating the selected items.  For example, the
record viewed via SQL shows:  "Agribusiness,Commercial Litigation" (less the
quotes) in the field.  Both of those practice groups are identically listed
in the GetPG.PG list.  Yet neither of them are showing up selected in the
control.  Plus, if I replace

            <CFIF ListContains(GetPG.PG,EditNameQry.PracticeGroup)>
with

            <CFIF ListContains(GetPG.PG,"Agribusiness")>

the Agribusiness option is selected.  So I think I'm doing something wrong
in how I'm using the second parameter of the ListContains.


Athelene



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


take the cfoutput tags out of the options and put them within the entire
select tag:

        <cfselect name="NewPG" size="3" multiple>
          <CFOutput query="GetPG">  <!--- OPENING CFOUTPUT --->
            <CFIF ListContains(GetPG.PG,EditNameQry.PracticeGroup)>
                <CFSET PGSelected = "Selected">
            <CFELSE>
        <CFSET PGSelected = "">
            </cfif>
           <Option #PGSelected# value="#PG#">#PG#</option>  <!--- NO
CFOUTPUTS --->
          </cfoutput>  <!--- CLOSING CFOUTPUT --->
        </cfselect>

-----Original Message-----
From: Gieseman, Athelene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 08, 2000 3:44 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Multiple value Select


Still no luck.  I also added an rtrim function to each of the fields in that
line.  And I've tried David's suggestion of using listcontainsnocase.  Still
no luck.  I also changed the code this way:

<CFIF listfindnocase(rtrim(getpg.pg),rtrim(EditNameQry.PracticeGroup))>
<CFSET PGSelected = "Selected">
<CFELSE>
<CFSET PGSelected = "Not Selected">
</cfif>
<Option #PGSelected# value="#PG#"><cfoutput>#PG#
#PGSelected#</cfoutput></option>

so that I would be able to see if the PGSelected was being set at all.  When
I use this code, the output on all of the options has "Not Selected" after
it.  So I believe the problem is that the listcontains never finds a match.
I've changed the database from a char to a varchar (based on earlier posts
about that issue), edited all of the records in the file to eliminate any
extra spaces at the end, used the rtrim function.  And still it's not ever
finding a match.

I appreciate the continuing help!  This one is making me crazy (well, more
crazy than usual.)

Athelene

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


Try replacing the cfloop with cfoutput like so:


<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>
          <CFOutput query="GetPG">
            <CFIF ListContains(GetPG.PG,EditNameQry.PracticeGroup)>
                <CFSET PGSelected = "Selected">
            <CFELSE>
        <CFSET PGSelected = "">
            </cfif>
           <Option #PGSelected# value="#PG#">#PG#</option>
          </cfoutput>
        </cfselect>

I had the CFLoop in there because i had cfoutputs around it in my code...
this should do it for you, if not, let me know...




-----Original Message-----
From: Gieseman, Athelene [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 08, 2000 1:03 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Multiple value Select


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.

----------------------------------------------------------------------------
--
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.
----------------------------------------------------------------------------
--
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