• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

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

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
H2O
Asked:
H2O
  • 3
  • 2
  • 2
  • +3
1 Solution
 
danrosenthalCommented:
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
 
reitzenCommented:
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
 
anandkpCommented:
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
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
hartCommented:
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
 
H2OAuthor Commented:
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
 
reitzenCommented:
<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
 
weeezlCommented:
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
 
danrosenthalCommented:
H20....try my solution...I think it is what you are looking for.
0
 
H2OAuthor Commented:
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
 
H2OAuthor Commented:
Mr. Weeezl is it?

Good job.

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

Thanks.

H2O
0
 
anandkpCommented:
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

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 3
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now