Solved

Manual selection in CFSELECT

Posted on 2014-12-30
5
91 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

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

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…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 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