troubleshooting Question

Drop-down value on update entering list item not value

Avatar of earwig75
earwig75 asked on
ColdFusion Language
21 Comments1 Solution502 ViewsLast Modified:
I have a drop-down that populates with some items/values from a reference table. When a choice is selected the value is written to the master table; this works fine.

When the record is edited the drop down is populated with the value that was previously selected (this is what I want to happen) but if the drop-down doesn't change it passes along the item name instead of what i want - the (numeric) value.

Could someone help with this? Would I have to change my update statement somehow so it displays the item name but still captures the value? Below is an example of what I currently have on my update (the relevant code).


 <cffunction name="update"
             hint="Update a record">
<cfargument name="ReferenceNumber"
              hint="Reference Number">
<cfargument name="OfferType"
              hint="Offer Type">

<cfquery datasource="#datasource#">
  UPDATE [DB].[dbo].Tbl_Record_Master
  SET OfferType=<cfqueryparam value = "#ARGUMENTS.OfferType#" CFSQLType = "CF_SQL_VARCHAR">, ..........

WHERE ReferenceNumber=#ARGUMENTS.ReferenceNumber#
  <cfreturn true>


<cffunction name="GetOfferTypes"
             hint="Get Offer Types">

  <cfquery datasource="#Datasource#"
  SELECT OfferTypeID, OfferType
  FROM [DB].[dbo].Rtbl_Record_OfferType
  ORDER BY OfferTypeID
  <cfreturn offertypes>


Form page

<cfinvoke component="myCFC"

 <cfset OfferType=record.OfferType>

<cfinvoke component="myCFC"

<cfform action="process.cfm">
     <SELECT NAME="OfferType">
            <CFOUTPUT QUERY="OfferTypes">
                  <OPTION VALUE="#OfferTypeID#">#OfferType#</OPTION>

Process page

<cfinvoke component="myCFC"

<cfinvokeargument name="OfferType"
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 21 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 21 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros