It's a little kludgy, but you can redo your logic on the called template
a little bit and pass both variables to it at the same time like so:
<SELECT NAME="CatagoryID" SIZE="7">
<CFOUTPUT QUERY="GetCatagory">
<option value='#CatagoryID#_#CatagoryDescription#'>
#CatagoryDescription# #CatagoryID#
</CFOUTPUT>
</SELECT>
Then what gets passed is #CatagoryID#_#CatagoryDescription# which you
can treat as a list and get each variable like so:
#ListFirst(FORM.CategoryID, '_')# returns the actual CategoryID, so you
can set a variable equal to it such as <CFSET PassedCategoryID =
#ListFirst(FORM.CategoryID, '_')#>
#ListLast(FORM.CategoryID, '_')# returns the category description
You'll have to be a little careful to not ever have pound signs,
apostrophes, quotes, or other underscores (or you can use a different
delimiter) in your category descriptions, or they may cause errors.
Perhaps redo your logic on the called page something like this:
<CFIF Len(Variables.PassedCategoryID IS NOT 0>
<CFINSERT DATASOURCE="SCENARIO" TABLENAME="ScenarioDetail" >
</CFIF>
Setting a PassedCategoryID variable like this isn't absolutely necessary
but it's cleaner. You could skip it and use <CFIF
Len(ListFirst(#FORM.CategoryID#, '_')) IS NOT 0> for example. There are
lots of ways to skin this cat.
Regards,
Karl Simanonok
Original message:
============
Date: Fri, 07 Jul 2000 00:57:23 -0400
From: [EMAIL PROTECTED] (Olson, Kelly)
To: [EMAIL PROTECTED]
Subject: Newbie: SELECT Question
Message-ID: <[EMAIL PROTECTED]>
Is it possible to move several fields form a form select.
I have a database of two fields: CatagoryID and CatagoryDesc.
I am building a select as follows:
<SELECT NAME="CatagoryID" SIZE="7">
<CFOUTPUT QUERY="GetCatagory">
<option value='#CatagoryID#'> #CatagoryDescription# #CatagoryID#
</CFOUTPUT>
</SELECT>
I am then reloading the same template page where at the top I have:
<CFIF IsDefined("CatagoryID")>
<CFINSERT DATASOURCE="SCENARIO" TABLENAME="ScenarioDetail" >
</CFIF>
What I really need to do is insert both the CatagoryID and the
CatagoryDescription,
but a SELECT only seems to be able to move one value. Is there a way to
move the second value?
------------------------------------------------------------------------------
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.