Solved

how to display selected option in a SELECT menu?

Posted on 2014-07-30
2
169 Views
Last Modified: 2014-07-30
ColdFusion 9

Hi. I am having a little trouble. I am editing a record that contains data from a SELECT menu. When I view the edit page, how can I get the form to display the selected value in the SELECT menu? Here is what I have so far:

<!--- this query selects PresentationFormat from lookup table LookupPresentationType --->
<cfquery datasource="#APPLICATION.dataSource#" name="GetPres">
        SELECT  PresentationFormat
        FROM    LookupPresentationType
</cfquery>

<p>Indicate whether you are submitting for an oral paper, poster, or either format.</p>

<select size="4" name="PresentationFormat" multiple="no">
                 <option value="">Select Presentation Format:</option>
<cfloop query="GetPres">
<cfoutput>
<option value="#GetPres.PresentationFormat#" <CFIF editAbstract.PresentationFormat IS (not sure what goes here... but you see where I am going with this)>selected</CFIF> >#GetPres.PresentationFormat#</option>
</cfoutput>
</cfloop>  

                </select>  

Open in new window

               

Thank you as always. =)

Eric
0
Comment
Question by:Eric Bourland
2 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 40230707
Hi Eric!

You would want to match it up to the value you have putting in the VALUE tag: GetPres.PresentationFormat


<option value="#GetPres.PresentationFormat#" <CFIF editAbstract.PresentationFormat IS GetPres.PresentationFormat>selected</CFIF> >#GetPres.PresentationFormat#</option>
0
 
LVL 3

Author Closing Comment

by:Eric Bourland
ID: 40230719
Of course. =) Why could I not wrap my head around that?  =)

That worked like a charm.

Thanks as always, gdemaria. Hope you are great, and enjoying the summer.

Eric
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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

23 Experts available now in Live!

Get 1:1 Help Now