Carla Dessi
Carla Dessi

Reputation: 9666

Adding a default null value to a select tag

I currently have this line of code:

=select_tag :resource_id, options_for_select( Resource.find(:all, :conditions => "resourcetype = 'data-sheets' && category = 'Data Centres'", :order => "title ASC").map{|l| [l.title, l.id] }, @dc.try(:resource_id) )

Which works in the sense it displays a list pulled from the database, and selects the current value of the field, but I need to add a "please select" option to the top of the list with no value..

Upvotes: 1

Views: 1266

Answers (1)

trh
trh

Reputation: 7339

There's an option for "blank"

:include_blank => true

Additionally you can use prompt to set the value of that text

Upvotes: 1

Related Questions