cfselect display attribute

Posted on 2005-03-21
Medium Priority
Last Modified: 2013-12-24
I have a cfselect:

<cfselect query="getStaff" value="StaffID" display="FirstName"  name="preparedby"></cfselect>

Is there a way to have the display show the firstname and lastname together, as in display="FirstName & LastName" (which doesn't work, btw)?
Question by:theamzngq
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
LVL 21

Accepted Solution

pinaldave earned 800 total points
ID: 13594588
okey what you can do is that in your query you can join them...

select firstname+lastname as fullname

now you can use that fullname in your query. This is how I have done in past.

Assisted Solution

kkhipple earned 800 total points
ID: 13594605
what you might want to do is make this concatenation (joining of strings) within the query

CFSELECT: http://livedocs.macromedia.com/coldfusion/5.0/CFML_Reference/Tags91.htm

<CFQUERY name = "getStaff" ... >
SELECT firstName, lastName, firstName || lastName as fullName, StaffID
FROM users

<cfselect query="getStaff" value="StaffID" display="fullName"  name="preparedby"></cfselect>
LVL 14

Assisted Solution

by:Renante Entera
Renante Entera earned 400 total points
ID: 13597884
Hi theamzngq!

I agree with what pinaldave and kkhipple posted.  Both of them are correct but you should have to take note regarding concatenation.  Depending on your database, some uses "||" or "+".

But, why not using <select> tag ???  I think, it's simple and clean :-?

:: USING <select> ::
  <select name="preparedby">
    <cfoutput query="getStaff">
      <option value="#StaffID#">#FirstName# #LastName#</option>

Hope this helps you.  Just try it.

eNTRANCE2002 :-)
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.


Author Comment

ID: 13602265
You're right, entrance, I could do that.  I usually do, actually, but I have a new found desire to take advantage of the built in functionality that CF has to offer.  I spend a lot of time working on forms, and I'm trying to use as much automated stuff as possible.  In the end, using a regular select is probably easier.
LVL 21

Expert Comment

ID: 13613337
Hi theamzngq,
do you still need help. or it is all good now.


Author Comment

ID: 13613667
Sorry, I haven't tried it out yet.  But I will today, and let you know...

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 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