?
Solved

Simple Question - How to Create Output Similar to a Select Dropdown But without the dropwdown part -125pts

Posted on 2003-03-24
11
Medium Priority
?
159 Views
Last Modified: 2013-12-24
Sounds kinda confusing but it isn't that bad.

First, I have a query that presents the possible data available for a dropdown.  Secondly, I have an IF statement that matches one of the listings with the record being viewed.  

>>What I want is the all of the benefits of the above without the dropdown part.<<

<td height="20" bgcolor="##FFFFFF"><span class="FormHeaders">*Prefix:</span><select name="hydt_preid" size="1" class="FormData">
  </cfoutput>
<cfoutput query="hydtprefix">                              
     <CFIF hydtprefix.hydt_preid eq getdtls.mhpre>
          <option selected value="#hydtprefix.hydt_preid#">#hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#</option>
     <CFELSE>
          <option value="#hydtprefix.hydt_preid#">#hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#</option>
     </CFIF>
</cfoutput>
<CFOUTPUT query="getdtls">
0
Comment
Question by:H2O
[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
  • 3
  • 2
  • 2
  • +3
11 Comments
 
LVL 15

Expert Comment

by:danrosenthal
ID: 8198869
looking for something like this?....

<CFIF ListFind(quotedvaluelist(hydtprefix.hydt_preid),getdtls.mhpre)>
     <CFOUTPUT>#hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#</cfoutput>
<CFELSE>
     <!--- Prefix not found --->
     <!--- Insert default, or present error message here --->
</cfif>
0
 
LVL 6

Expert Comment

by:reitzen
ID: 8199340
Would a list box give you the result you are looking for?

<td height="20" bgcolor="##FFFFFF">
<span class="FormHeaders">*Prefix:</span>
<select name="hydt_preid" size="<cfoutput>#hytdprefix.RecordCount#</cfoutput>" class="FormData">

<cfoutput query="hydtprefix">
  <option value="#hydtprefix.hydt_preid#"
    <CFIF hydtprefix.hydt_preid eq getdtls.mhpre>
       selected
    </CFIF>
  >#hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#
  </option>                            
</cfoutput>

</select>
</td>
0
 
LVL 17

Expert Comment

by:anandkp
ID: 8200264
how abt this !

<TABLE WIDTH="100%" ALIGN="CENTER" BORDER="0" CELLSPACING="0" CELLPADDING="0">
     <CFOUTPUT query="hydtprefix">
          <TR>
               <CFIF hydtprefix.hydt_preid eq getdtls.mhpre>
                    <TD BGCOLOR="e9e9e9">#hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#</TD>
               <CFELSE>
                    <TD>#hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#</TD>
               </CFIF>
          </TR>
     </CFOUTPUT>
</TABLE>

K'Rgds
Anand
0
Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

 
LVL 11

Expert Comment

by:hart
ID: 8200307
i also agree with anandz suggestion.

You could form it in any manner as per the above code given by him :-)

Regards
Hart(Harish)
0
 

Author Comment

by:H2O
ID: 8202732
Reitzen: Your output is the same as my example.

anandkp: Your output lists all possible.

danrosenthal: I didn't test yours because I didn't see an equation to stipulate the 'selected' record.

Lets say that for this example the possible records in the table include(notice the field determinations);

In this scenario the record has for the Hydt_preid, 3.
(hydt_preid)[hydt_pre] {areashort}
(2)[C]{Clermont}
(3)[F]{Fishers}
(4)[HC]{Homecroft}

In anandkp's suggestion, the output lists all in an unorderly fashion.  Reitzen (like mine) outputs in all in a drop down with the selected record(in this case 3, F-Fishers) located at the top of the list.

What I am wanting though is the following:

3, F-Fishers

Only.

Thanks.
0
 
LVL 6

Expert Comment

by:reitzen
ID: 8204182
<td height="20" bgcolor="##FFFFFF">
<span class="FormHeaders">*Prefix:</span>
<cfoutput query="hydtprefix">
 <CFIF hydtprefix.hydt_preid eq getdtls.mhpre>
    #hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#
 </CFIF>
</cfoutput>
</td>
0
 
LVL 2

Accepted Solution

by:
weeezl earned 500 total points
ID: 8204195
Just follow your own logic and leave out the exterraneous results:

<cfoutput query="hydtprefix">                              
    <CFIF hydtprefix.hydt_preid eq getdtls.mhpre>
    #hydtprefix.hydt_preid# #hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#
    </CFIF>
</cfoutput>

Wouldn't that work? You could even run the cfoutput higher up on the page and store the result as a variable for simple display later...

<cfoutput query="hydtprefix">                              
    <CFIF hydtprefix.hydt_preid eq getdtls.mhpre>
    <cfset selectedrecord="#hydtprefix.hydt_preid# #hydtprefix.hydt_preid#, #hydtprefix.hydt_pre#, #hydtprefix.areashort#">
    </CFIF>
</cfoutput>

Yes?
0
 
LVL 15

Expert Comment

by:danrosenthal
ID: 8204752
H20....try my solution...I think it is what you are looking for.
0
 

Author Comment

by:H2O
ID: 8205520
danrosenthal- intertestingly enough the output is the same as both Reitzen and mine.

Let me reiterate, I don't want a drop down.  I simply want the match to the record.  If the record's hydt_preid is 3 then I want the information that matches it, in this case it is F and Fishers.

I have yet to test Reitzen's newest or weeezl's input.  Hopefully in the next few.

Thanks.
0
 

Author Comment

by:H2O
ID: 8205753
Mr. Weeezl is it?

Good job.

Simple and straight to the point.  It seems so easy when you see it.

Thanks.

H2O
0
 
LVL 17

Expert Comment

by:anandkp
ID: 8208040
well i wonder how it wld go in an unorderly fashion

if its with teh table structure - i had just put up a eg - the changes cld have been made to it as per ur template requirements .. i was just giving a logical method to do it.

no problem

Cheers,
Anand
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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 brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

741 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