Rails Trying to submit a form onchange of dropdown

后端 未结 11 1265
遥遥无期
遥遥无期 2020-12-13 20:28

I have my Ajax working, builtin Rails javascript, with the submit button. However, I would like it to submit when I change the value of the dropdown box and eliminate the b

11条回答
  •  隐瞒了意图╮
    2020-12-13 21:21

    This is an old question, but none of the above answers work for me. They all result in a text/html request.

    The following works, e.g. (the hide class sets css display: none):

    <%= form.radio_button :tier_id, tier.id, onchange: "$('#submit-button-id').click();" %>
    

    together with:

    <%= form.submit "Save changes", id: 'submit-button-id', class: 'hide' %>
    

提交回复
热议问题