Hi Ricq

Your code is comparing only the first value returned from the
"get_user_del_locn" query with all the others from "get_del_locn" and
thus... only one match can happen... if that.

I didn't think much of a solution though but... how about building only one
query that intersects user locations with all avaliable locations? That will
give you a list of only the locations you really need.

Francisco J. Montes-Mantero
Web Developer
QSP Financial Information Systems
[EMAIL PROTECTED]
(0191) 4023491
ICQ: 23816813

----- Original Message -----
From: "Ricq Pattay" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 11, 2000 2:33 PM
Subject: pre-selecting items in a multiple list box


> I'm using a CF template that attempts to pre-select several items in a
list
> box based on values returned from 2 queries. If a match occurs, that entry
> in the list box should be selected. There will almost always be more than
> one match. Specifically, the list box should list all possible delivery
> locations (from the get_del_locn query) and highlight/pre-select those
> locations that a user has a record returned for in get_usr_del_locn. What
> the code below produces *almost* works - all possible delivery locations
are
> in the list box, but only *one* of the user's specific locations is
selected
> even though they might have 4 or 5 locations tied to their usr_id.
>
> So... Why doesn't this code work?
>
> <!--- get a user's specific delivery locations --->
>   <cfquery datasource="centsup_dev" name="get_user_del_locn" debug="yes">
>   select user_del.dlo_id
>   from del_locn, user_del
>   where del_locn.dlo_id = user_del.dlo_id
>    and user_del.usr_id = #usr_id#
>   </cfquery>
>
> <!--- get all possible delivery locations --->
>   <cfquery datasource="centsup_dev" name="get_del_locn" debug="yes">
>   select dlo_id, dlo_locn
>   from del_locn
>   order by dlo_locn
>   </cfquery>
>
> <!--- create the list box; attempt to pre-select user's location(s) --->
>   <select name="dlo_id" size =5 width=150 multiple>
>   <cfoutput query="get_del_locn">
>    <cfif #get_user_del_locn.dlo_id# is #get_del_locn.dlo_id#>
>     <option value=#get_del_locn.dlo_id# selected>#get_del_locn.dlo_locn#
>    <cfelse>
>     <option value=#get_del_locn.dlo_id#>#get_del_locn.dlo_locn#
>    </cfif>
>   </cfoutput>
>   </select>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~
> Ricq Pattay <[EMAIL PROTECTED]>
> Univ of MN College of Veterinary Medicine
>
>
>
>
> --------------------------------------------------------------------------
----
> 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.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.

Reply via email to