Solved

Manual selection in CFSELECT

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

Stressed Out?

Watch some penguins on the livecam!

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 …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

623 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