sunil kalyan
sunil kalyan

Reputation: 27

How to add placeholder for drop down menu

I want placeholder text (predefined one "Select any status") for my drop down menu.The following is my code for drop down menu

<%= f.select :status,[[],['Created','Created'],['Deleted','Deleted'],
['Modified','Modified'],['Stored','Stored'],['Trained/Broken','Trained/Broken'],
['Unnecessary','Unnecessary']] %> 

Ruby:1.9.3 Rails 3.2.13

Thanks in advance

Upvotes: 2

Views: 4441

Answers (1)

Richard Peck
Richard Peck

Reputation: 76774

You can use prompt for this:

<%= f.select :status,[[],['Created','Created'],['Deleted','Deleted'],
['Modified','Modified'],['Stored','Stored'],['Trained/Broken','Trained/Broken'],
['Unnecessary','Unnecessary']], prompt: "Please Select" %>

Upvotes: 4

Related Questions