我可以在 select_tag 中包含空白字段吗? [英] Can I include blank field in select_tag?
本文介绍了我可以在 select_tag 中包含空白字段吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以添加类似 :include_blank => 的选项?在方法
就像 select_tag
中的请选择"select
方法一样?它似乎不起作用.select_tag
方法有什么替代方法吗?
Is it possible to add an option like :include_blank => 'Please Select'
in a method select_tag
like it is possible with the select
method? It seems not to work. Is there any substitute for this for select_tag
method?
推荐答案
在 Rails 3 中,select_tag
有一个 :prompt
选项:
In Rails 3 there is a :prompt
option for select_tag
:
select_tag "things", many_thing_as_options, :prompt => "Please select"
这篇关于我可以在 select_tag 中包含空白字段吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文