Solved

Manual selection in CFSELECT

Posted on 2014-12-30
5
89 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
  • 3
5 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

21 Experts available now in Live!

Get 1:1 Help Now