Avatar of earwig75
earwig75
 asked on

How do I make the first entry in a CFSELECT blank/empty?

I am using the CFSELECT statement below to populate a drop-down box. I need the first choice to be left blank. Other than creating a blank or NULL option in the database, it is possible? I need to make the first option blank and the drop-down required. Below is what I am using - thank you.

 <cfselect name="TypeOfWidget"
             query="TypeOfWidget"
             value="TypeOfWidget"
             display="TypeOfWidget"
             selected="#VARIABLES.TypeOfWidget#">
   </cfselect>
ColdFusion Language

Avatar of undefined
Last Comment
_agx_

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
gdemaria

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
earwig75

ASKER
What would I use for getQuery.value and getQuery.label in your example? I'm sorry I am a bit confused and should mention I am a beginner.
SOLUTION
gdemaria

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
earwig75

ASKER
Thank you. So the value us what would get written to my master table? Would I then need to have additional code when viewing the record to say value 1 is widget A?
SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
earwig75

ASKER
Ok, I basically have 1 master table where I am storing all details of my record. The drop down I started this thread about is a list of things that I am populating the drop down with. After a record is created, it can be viewed on a .cfm page and edited again.

This is the query I am using for the drop down:

In my CFC:
 <cffunction name="GetSources"
             returntype="query"
             hint="Get Sources">

  <cfquery datasource="#datasourcea#"
           name="sources">
  SELECT OrderID, Source
  FROM Rtbl_Source
  ORDER BY OrderID
  </cfquery>
  <cfreturn sources>

 </cffunction>

On the page with drop-down:
 <cfinvoke component="origdb"
           method="GetSources"
           returnvariable="sources">

Am I doing this in a way that is not preferred? I believe I am storing the "source" in my master DB as the real value and not the "ID" which I am calling OrderID so I could order them easier on my page.

Thanks again for the help everyone.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
SOLUTION
gdemaria

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
gdemaria

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.