模态中的Bootstrap表单不提交

时间:2017-11-09 20:53:54

标签: twitter-bootstrap pug bootstrap-modal

单击“提交”时,表单不响应(并且没有任何内容发送到服务器)。我暂时从随机网站将表单的值设置为GET。关闭按钮正确关闭模态。我是在this example

工作的
cgi-bin

1 个答案:

答案 0 :(得分:0)

从“#editForm.form”更改为“form”并且似乎已经有效,请查看此代码,同样在codepen中:

body
  p test
  .modal-dialog
    .modal-content
      // Modal Header
      .modal-header
        button.close(type="button", data-dismiss="modal")
          span(aria-hidden="true") ×
          span.sr-only Close
        h4#myModalLabel.modal-title
          | Edit Resource
      // Modal Body
      .modal-body
        //#editForm.form(role='form' method='GET' action='https://www.google.com/')
        form(role='form' method='GET' action='https://www.google.com/')
          div.form-group
            label(for='name') Name:
            input#name.form-control(type='text', placeholder='name' name='name')
          div.form-group
            label(for='email') Email:
            input#email.form-control(type='email', placeholder='name@email.com' name='email')
          button.btn.btn-primary(type="submit", name="asdf") Submit
          button.btn.btn-default(type="button", data-dismiss="modal")
            | Close