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
Solved

how to display selected option in a SELECT menu?

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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