Solved

how to display selected option in a SELECT menu?

Posted on 2014-07-30
2
171 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

832 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