Solved

real simple(why is this not working)

Posted on 2002-03-18
15
124 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now