Hi Peter -
I want to have a select combo-box on a page, and am using "collection_select" to create it. I wanted to give the user a blank option to choose from, and so found ":include_blank => true", which works perfectly.
However: The blank entry does not have any text assigned to the option, and so could be a little vague for the user, I would like to give this blank option text like "(none)" or something similar. I am beginning to believe I can't use collection_select to do this, but need to use "select", is this the case? Perhaps someone would be kind enough to point out the differences, and get me started.
Many thanks for helping out, it's much appeciated, and again, apologies if this is a dumb question
Not a dumb question at all. I'm doing pretty much what you're doing in my own app, and I did it this way:
<%= collection_select(:security_question, :id, SecurityQuestion.find(:all), :id, :question, options ={:prompt => "(Select a question)"}, :class =>"security_question") %>
The trick is in this: options ={:prompt => "(Select a question)"}
That makes the first line of HTML spit out for the select look like this:
<select class="security_question" id="security_question_id" name="security_question[id]"><option value="">(Select a question)</
You can see that when the user loads the form, that select says "(Select a question)", and that option has no value - so if it's left that way when they submit the form, there'll be no value associated with the ID of the select passed to your controller, so you can tell they didn't choose anything.
Does that get you where you want to go?