Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Manual selection in CFSELECT

Posted on 2014-12-30
5
Medium Priority
?
101 Views
Last Modified: 2014-12-30
Hi,
 
 I have a field called "(Order)Processor" and on order form, I have the following code:

                  <CFSELECT NAME="Processor">
                        <OPTION VALUE="amy@abc.com">Amy
                        <OPTION VALUE="lyndsay@abc.com">Lyndsay
                        <OPTION VALUE="shari@abc.com">Shari
                        <OPTION VALUE="teri@abc.com">Teri
                  </CFSELECT>

When Shari is chosen in drop-down, then the system actually stores "shari@abc.com" in the table and no problem here.
But when I query the record that has processor with "shari@abc.com", how can I display the drop-down menu using CFSELECT and make sure Shari is selected but list other processor names (Amy, Lyndsay and Teri) at the same time so that users can pick another order processor if they like to do so?

<CFQUERY NAME="FindOrder" DATASOURCE="Order">
      Select      *
      FROM      Orders
    WHERE   ID = #cfgridkey#
</CFQUERY>

Note. I don't have a separate table that stores (order) processor names and their email addresses.
0
Comment
Question by:sglee
[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
5 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 2000 total points
ID: 40524428
You want to add CFIF statements as shown below.
I don't know the variable you have that holds the current processor's email address, so I made up currentProcessor.   Just replace this word with the variable that holds the email of the person selected.  My example is on the first two, you want to do it in all.

I do suggest that you create a table of these people and use the ID instead of their email address.   If their email address changes, you are in some big trouble!

          <CFSELECT NAME="Processor">
                        <OPTION VALUE="amy@abc.com" <cfif currentProcessor is "amy@abc.com">selected</cfif>  >Amy
                        <OPTION VALUE="lyndsay@abc.com" <cfif currentProcessor is "lyndsay@abc.com">selected</cfif>>Lyndsay
                        <OPTION VALUE="shari@abc.com">Shari
                        <OPTION VALUE="teri@abc.com">Teri
                  </CFSELECT>

Open in new window

0
 

Author Comment

by:sglee
ID: 40524494
Let me try that.
0
 

Author Comment

by:sglee
ID: 40524537
That works great.
In hindsight, I should have created a table. I did not think it would matter.
Good thing is that email addresses won't change although the company may hire a new person or loose existing people.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 40524548
>> If their email address changes, you are in some big trouble!

Also, embedding email addresses in the html attracts spammers.
0
 

Author Comment

by:sglee
ID: 40524571
>>embedding email addresses in the html attracts spammers.

well noted.
0

Featured Post

Google Certified Professional - Cloud Architect

This course (1 of 3) is designed to help students who are interested in Google Cloud Platform (GCP) to become familiar with the platform, navigate the console and learn its capabilities. It will also prepare students for the Google Cloud Architect certification exam.

Question has a verified solution.

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

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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