Solved

Manual selection in CFSELECT

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

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…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

25 Experts available now in Live!

Get 1:1 Help Now