Rails simple_form: custom input id

前端 未结 1 868
萌比男神i
萌比男神i 2021-02-12 09:30

I want to put several forms generated with Rails simple_form on a one page, and operate on them with javascript. However simple_form generated same ids for respective inputs in

1条回答
  •  隐瞒了意图╮
    2021-02-12 10:19

    You're almost there.

    The trick is in specifying the :input_html.

    <%= f.input :id, :as => :hidden,
          :input_html => {
            :value => @question.id,
            :id => "question_id_1"
          } %>
    

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