select tag
syntax:
select_tag(name, option_tags = nil, options = {})
Link
different forms of select_tag:
1, <%= select_tag :qual, options_for_select([["BE",1],["B.TECH",2],["ME",3],["M.TECH",4],["BSC",5]]), {:multiple=>true} %>
2,<%= select_tag :qual, options_for_select([["BE",1],["B.TECH",2],["ME",3],["M.TECH",4],["BSC",5]]), { include_blank: true }%>
3,<%= select_tag :qual, options_for_select([["BE",1],["B.TECH",2],["ME",3],["M.TECH",4],["BSC",5]]), { :prompt => 'please select' }%>
output: (1,2,3 outputs in sequence)
explanation:
OPTIONS:
:multiple
- If set to true the selection will allow multiple choices.:disabled
- If set to true, the user will not be able to use this input.:include_blank
- If set to true, an empty option will be created.:prompt
- Create a prompt option with blank value and the text
Select In edit page: to get previous values
<%= f.select :genre, options_for_select([["Comedy",:Comedy],["Love",:Love],["Message",:Message],["Photography",:Photography],["Romantic",:Romantic],["Entertainment",:Entertainment],["Demo Oriented",:Demo],["Documentaries",:Documentaries],["Others",:Others]], @marketing.genre),{},{:class=>"multiselect",:multiple => true}%>
No comments:
Post a Comment