Close Bootstrap modal on form submit

后端 未结 13 1484
盖世英雄少女心
盖世英雄少女心 2020-12-08 07:08

I have a Bootstrap modal dialog which contains a form. The modal dialog contains a submit and a cancel button. Now on submit button click the form is submitted

13条回答
  •  悲&欢浪女
    2020-12-08 07:23

    I had the same problem and finally got it working with this code:

    <%=form_with id: :friend_email_form, url: friend_emails_create_path do |f|%>
    
                          # form fields entered here
    
    
    <%= f.submit "Send Email", class: 'btn btn-primary', "onclick":"submit_form();", "data-dismiss":"modal"%>

    The selected answer did not work for me.

提交回复
热议问题