Question: Select list and default options

I know I’ve seen the answer for this somewhere and now when needed I
can’t find it.
If I have a select list from a table but i want an option like “please
select” as the default option to come up how would I add that in ?

bump …anyone know the answer ?

Please Select 1 2 ...

Please remember in the future that this list is for questions specific
to
Rails, not HTML.

It is Rails related.
Currently I have collection_select(:table, method, :id :name)
Within this I wanted to know if there was a specific way to add an
option in addition to what I’m pulling out of the database.

Stuart

I am not sure if this answers your question but at:
http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000404

For “options_for_select” and “collection_select” I found options
“:include_blank” and “:selected”.

On 9/4/06, Dark A. [email protected] wrote:

I know I’ve seen the answer for this somewhere and now
when needed I can’t find it. If I have a select list
from a table but i want an option like “please select”
as the default option to come up how would I add that
in ?

Perhaps you are referring to AWDWR page 105?

<%=
options = [[“Select a payment option:”, “”]] + Order::PAYMENT_TYPES
select(“order”, “pay_type”, options)
%>

  • Mark.