I only seem to be able to add
<option value = "">Select All
at the end, or I get an error.
Thanks!
Rick
<option value = "">Select All
at the end, or I get an error.
Thanks!
Yeah, but I bet this would work anywhere in the select:
<option value = "">Select All</option>
OR
<option value = ""></option>
OR maybe
<option value = "" /> <!-- I've never tried this one, so I don't know if
it is legal -->
Tried all these:
""Yeah, but I bet this would work anywhere in the select:
<option value = "">Select All</option>
OR
<option value = ""></option>
OR maybe
<option value = "" /> <!-- I've never tried this one, so I don't know if
it is legal -->""
No go. Got "Invalid token 'o' found on line 24 at column 12." errors for all
of them.
And the queryposition attribute is supported in CFMX7 and I'm working on CFMX
6.1.
Am I out of luck on 6.1? Seems like a pretty basic functionality.
Thanks again,
Rick
Rick, the error you're describing sounds more like a ColdFusion bug
rather than an HTML bug. The <option value="">Select All</option> code
will work just fine. You'll need to check how you're handling this
case when you process the form with CF. If you post some code here I
might be able to help you find the problem (and hopefully a solution).
you MUST close all <option> tags inside <cfselect> with </option>,
otherwise they will not work properly (i.e. the first option will not be
displayed).
your "Invalid token 'o' found on line 24 at column 12." indicates that
your <option> tags are not closed.
<option value = "">Select All</option>
OR
<option value = ""></option>
OR maybe
<option value = "" /> <!-- I've never tried this one, so I don't know if
it is legal -->""
and still got the invalid token:
Invalid token 'o' found on line 24 at column 12.
The CFML compiler was processing:
* a cfselect tag beginning on line 23, column 10.
The error occurred in sampleForm.cfm: line 24
22 : <cfform action="test.cfm" name="myForm">
23 : <cfselect
24 : <option value = ""></option>
25 : name = "course"
26 : message = "you must make a selection"
You need to close the cfselect tag before starting the option tags.
GOODNESS! close the end bracket of your <cfselect>!!!
<option ...> go inbetween <cfselect> and </cfselect>, not INSIDE
<cfselect <option>>!!!!
<cfselect>
<option value="">Select an value</option>
</cfselect>
Anyways, here's another solution if you pass in a query
Build it into the query using a union so that the first row has a null or ''
value and either a blank display or a message stating the user needs to make a
selection.
The below example uses oracle/dual. Tune for your database specifics.
<cfquery name="myQuery" datsource="myDSN">
select null as valueColumn, 'Select an Option" as displayColumn,0 as sortOrder
from dual
union
select valueColumn, displayColumn, 1 as sortOrder from myTable
order by sortOrder asc
</cfquery>
<cfselect display="displayColumn" value="valueColumn" query="myQuery" />
Here's the whole tag:
<cfform action="test.cfm" name="myForm">
<cfselect
name = "course"
message = "you must make a selection"
onError = "text"
size = "1"
multiple = "No"
selected = "none"
query = "links" value = "SiteName" required = "Yes">
</cfselect>
</cfform>
<cfform action="test.cfm" name="myForm">
<cfselect
name = "course"
query = "links"
required = "Yes"
message = "you must make a selection"
onError = "text"
size = "1"
multiple = "No"
selected = "none"
value = "SiteName" >
<option value = "" selected>
</cfselect>
</cfform>
Phil
Rick