Solved

real simple(why is this not working)

Posted on 2002-03-18
15
127 Views
Last Modified: 2013-12-24
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>

0
Comment
Question by:jriver12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
15 Comments
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
ID: 6877848
why not have it this way:

<cfoutput query="view_Edit">
         <select maxlength="1" value="#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>

CJ
0
 

Author Comment

by:jriver12
ID: 6877875
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>
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6877907
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
0
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

 

Author Comment

by:jriver12
ID: 6877926
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.
0
 

Author Comment

by:jriver12
ID: 6877952
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.
0
 

Author Comment

by:jriver12
ID: 6877955
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.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6877962
They are not case sensitive?

CJ
0
 

Author Comment

by:jriver12
ID: 6877968
no I have set no case sensitivity on any thing(until finalized)
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6877976
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
0
 

Author Comment

by:jriver12
ID: 6877985
on the page nothing is in the DD but the following appears
COMP
 Trade Out
 Not Applicable
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6877997
DD?
0
 

Author Comment

by:jriver12
ID: 6878013
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


0
 

Author Comment

by:jriver12
ID: 6878026
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.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6878037
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
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6878041
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
0

Featured Post

Turn your laptop into a mobile console!

The CV211 Laptop USB Console Adapter provides a direct Laptop-to-Computer connection for fast and easy remote desktop access with no software to install.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question