Here is the quote of my answer on the similar question on
www.experts-exchange.com:

============================
Q:
I am trying to do a form where you can select certain employees involved in
a project.  I can successfully pass these employees to the next page where
their names are displayed, "name1, name2" like that.

<CFSELECT NAME="Involvement" QUERY="get_emp" VALUE="name" MULTIPLE="Yes"
REQUIRED="Yes" MESSAGE="Please select employees involved"></CFSELECT>
-------------------------
But, I cannot use names in my table.  They must be ID numbers.  I can
convert the names to numbers ONLY if only one employee is selected from the
previous page.  When I have more than one, nothing happens.

<CFQUERY NAME="match_name_UserID" DATASOURCE="blabla" DBTYPE="ODBC">
  SELECT UserID
  FROM check
  WHERE name='#FORM.Involvement#'
</CFQUERY>

The code above is how I convert them.  How do I get it so that I can output
the numbers AND pass these numbers to another page so I can insert them into
a table?

Also, after passing these numbers, how do you insert these multiple numbers?
Do I use a loop or is there an automatic piece of code to use.
How do I calculate the number of names that were selected?
====================
A:
Here is what you need:

-----------------------------
<cfquery name="get_emp" datasource="BLABLA" dbtype="ODBC">
select UserID, Name from check
</cfquery>
<CFSELECT NAME="Involvement" QUERY="get_emp" VALUE="UserID" DISPLAY="name"
MULTIPLE="Yes" REQUIRED="Yes" MESSAGE="Please select employees
involved"></CFSELECT>
-----------------------------
Note that VALUE should contain UserID and DISPLAY - Name.

Now how you would retrieve selected rows:

-----------------------------
<CFQUERY NAME="match_name_UserID" DATASOURCE="blabla" dbtype="ODBC">
  SELECT UserID, Name
  FROM check
  WHERE UserID in (#form.Involvement#)
</CFQUERY>

-----------------------------
That's it.


stas@

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