Solved

real simple(why is this not working)

Posted on 2002-03-18
15
121 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
 

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
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 …
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

21 Experts available now in Live!

Get 1:1 Help Now