我想实现一个选择菜单,国家,一旦某个国家被选中,然后过滤与状态一个选择菜单。结合引导表单helper到simple_form
我用SimpleForm和Bootstrap所以下面似乎适合我的完美:http://vincentlamanna.com/BootstrapFormHelpers/state.html
我目前使用的country_select宝石与SimpleForm和我的代码包含:
<%= f.input :country, :id => "business_country", :input_html => { :class => "span6" } %>
<%= f.input :state, :input_html => { :class => "span6" } %>
当我包括相关的js文件并包含Bootstrap Form Helpers的默认示例代码,该行为按预期工作,但我想将其包含在我的SimpleForm中,以便我可以保存到数据库。这里是默认的示例代码,正确执行:
<select id="countries_states1" class="input-medium bfh-countries" data-country="US"></select>
<select class="input-medium bfh-states" data-country="countries_states1"></select>
任何人都可以建议如何实现这是SimpleForm?
谢谢。
是的。对不起,我忘了提到这一点。我相信我的主要问题是如何将'data-country =“countries_states1”'纳入我的简单字段。也许像':input_html => {“data-remote”=> true',但我不太确定要使用什么。 – Marklar 2013-05-14 03:22:04