Link to home
Start Free TrialLog in
Avatar of jriver12
jriver12

asked on

real simple(why is this not working)

the following should returne the previously entered selection as selected when displayed in a
drop down box.



 <cfoutput query="view_Edit">
          <select maxlength="1" value="#ex_comp_to#">
          <option value="COMP" #iif(view_Edit.EX_Comp_TO EQ "COMP", DE('selected'), DE(''))#>COMP</option>

<option value="TO" #iif(view_Edit.EX_Comp_TO EQ "TO", DE('selected'), DE(''))#>Trade Out</option>
<option value="NA" #iif(view_Edit.EX_Comp_TO EQ "NA", DE('selected'), DE(''))#>Not Applicable</option>
          </select></CFOUTPUT>

ASKER CERTIFIED SOLUTION
Avatar of cheekycj
cheekycj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jriver12
jriver12

ASKER

cj
that did not work it is showing the first Item in the list even after I update the record and then recall it.  

the method that I previously posted works great on another field that is also a dd now thisone that has the exact same syntax minust the different names is not working I don't get it.

any other suggestions this is how I have what you gave me to try



  <cfoutput query="view_Edit">
        <select maxlength="1" value="#ex_comp_to#" name="ex_comp_to">
<option value="COMP"<cfif view_Edit.EX_Comp_TO EQ "COMP"> selected</cfif>>COMP</option>
<option value="TO"<cfif view_Edit.EX_Comp_TO EQ "TO"> selected</cfif>>Trade Out</option>
<option value="NA"<cfif view_Edit.EX_Comp_TO EQ "NA"> selected</cfif>>Not Applicable</option>
        </select>
</CFOUTPUT>
something looks wrong..

you are looping through a query.. and if it is a certain value you are adding a "selected" to it.. but you are comparing the view_Edit query value to that..... are you sure you want to loop through the query? or is the query only have one row?



Maybe case sensitivity is the issue.. what is possible values of the ex_comp_to record?

CJ
the values that are to be in the Drop down are

Not applicable value=NA
Comp = Comp
Trade Out = TO

the query only has one row:  it is a simple record look up and update using the primary key as the index for the query.
the values that are to be in the Drop down are

Not applicable value=NA
Comp = Comp
Trade Out = TO

the query only has one row:  it is a simple record look up and update using the primary key as the index for the query.
the values that are to be in the Drop down are

Not applicable value=NA
Comp = Comp
Trade Out = TO

the query only has one row:  it is a simple record look up and update using the primary key as the index for the query.
They are not case sensitive?

CJ
no I have set no case sensitivity on any thing(until finalized)
I mean are the values you comparing... exactly..
try this:

<cfoutput query="view_Edit">
Comparing #view_Edit.EX_Comp_TO# to "COMP","TO","NA"
       <select maxlength="1" name="ex_comp_to">
<option value="COMP"<cfif view_Edit.EX_Comp_TO EQ "COMP"> selected</cfif>>COMP</option>
<option value="TO"<cfif view_Edit.EX_Comp_TO EQ "TO"> selected</cfif>>Trade Out</option>
<option value="NA"<cfif view_Edit.EX_Comp_TO EQ "NA"> selected</cfif>>Not Applicable</option>
       </select>
</CFOUTPUT>

What gets displayed?

CJ
on the page nothing is in the DD but the following appears
COMP
 Trade Out
 Not Applicable
Sorry  DD = drop Down List

disreguard the last comment I mistyped the code.  this is what is comming up now :

the text above the Drop Down list is :

Comp or Trade Out
Comparing TO to "COMP","TO","NA"

inside the drop down list is the following (exactly)
COMP
Trade Out
NotApplicable


cj thanks I like the thought of another method being introduced to me, besides the one I had.  


I would love to know what was wrong with mine, but oh well.

thanks for the help your solution worked great.
the following works for me:
<cfset view_Edit.EX_Comp_TO = "TO">
<cfoutput>
Comparing #view_Edit.EX_Comp_TO# to "COMP","TO","NA"
      <select maxlength="1" name="ex_comp_to">
<option value="COMP"<cfif view_Edit.EX_Comp_TO IS "COMP"> selected</cfif>>COMP</option>
<option value="TO"<cfif view_Edit.EX_Comp_TO IS "TO"> selected</cfif>>Trade Out</option>
<option value="NA"<cfif view_Edit.EX_Comp_TO IS "NA"> selected</cfif>>Not Applicable</option>
      </select>
</CFOUTPUT>

Are you sure that the file is not being retrieved from cache and your code changes are being recognized?

CJ
so it worked? Great.  Thanx for the "A".

There are a lot of ways of doing it.. I usually keep a delimited list to shorten the code even more.

CJ