Rails Trying to submit a form onchange of dropdown

后端 未结 11 1302
遥遥无期
遥遥无期 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:06

    I'm using rails 4.2.1 with jquery_ujs and it works for me:

    onchange: 'jQuery(this).parent().trigger("submit")'

    OBS.: It assumes the element is immediately child from form. You must adjust parent() according your DOM tree.

提交回复
热议问题