Manually set the ID's of form input fields in a simpleform form?

前端 未结 2 1911
攒了一身酷
攒了一身酷 2021-01-14 23:11

Is it possible to overrule simpleform\'s naming of textfields within a form?

This:

= f.input_field :age_from,

Outputs in:



        
相关标签:
2条回答
  • 2021-01-14 23:17

    Like your other question html options should be passed in input_html hash in simple_form:

    <%= f.input :age_from, ..., :input_html => { :id => 'my_id' } %> should work.
    
    0 讨论(0)
  • 2021-01-14 23:41

    I think you need to pass it in the html attribute hash

    html: {id: 'query'}

    0 讨论(0)
提交回复
热议问题