带有form_tag的动态选择菜单

时间:2016-04-09 18:00:42

标签: javascript ruby ruby-on-rails-4

我有一个表格标签表格,看起来像这样

  = label_tag 'fund', 'Fund'
  = select_tag :fund_id,
    options_for_select(??????),
    class: 'form-control reports-filter-select',
    include_blank: "-- Select Funds --"

  = label_tag 'scenario', 'Scenario'
  = select_tag :scenario_id,
    options_for_select(?????),
    class: 'form-control reports-filter-select',
    include_blank: "-- Select Scenarios --"

= submit_tag 'Submit',
  class: 'btn btn-primary',
  id: 'create-geodistribution-chart',
  data: { chart_url: reports_geodistributions_states_path(':scenario_id') }
= link_to 'Clear', '', class: 'btn btn-default clear'

我想创建一个动态选择框.....如果用户选择基金,那么所有属于该基金的场景将自动填充在场景选择框中

最好的方法是什么

谢谢

0 个答案:

没有答案