Solved

real simple(why is this not working)

Posted on 2002-03-18
15
125 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
website does not load without www 12 74
Script 12 175
Webserver access problem 5 76
Websocket through haproxy reused connection causes "Not a valid frame" error. 4 106
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…
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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