At 12:57 AM 7/7/00 -0400, you wrote:
>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?
I don't think you really need two columns in your select. The user probably
doesn't need to see the category id and you can still use the category id
as the value of the select. You could try closing the option by putting
</option> at the end of your values. But an easy workaround if you need to
show the category name and the category id to the user but you can't find
anything that works is this:
<cfoutput query="GetCategory">
<cfset CategoryOption="#CategoryDescription# #CategoryID#">
<option value=#CategoryID#>#CategoryOption#</option>
</cfoutput>
I've never built a select box from a query, but this will probably work. As
for your <cfinsert> that might be a problem. If you are sending the form to
the same page (I got that impression from the reloading thing) and the
information for the insert comes from the form with the select box, you
might be doing an update not an insert. If you start getting error messages
when you get this worked out further, write back.
------------------------------------------------------------------------------
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.