2017-09-19 18 views
0

对美化表单进行处理,但似乎无法找出将我的表单分成不同的divs时导致的错误。当表单嵌套在一个单独的div中时,它提交没有问题。但是,当我尝试使用div重码提交时,提交按钮不起作用。将输入分隔为不同的div时,玉形式无法提交

这里是断码:

.container 
    h5.panel-title Candidate Details 
    hr 
    form.form-group.input-group-sm(method='POST' action='') 
    .row 
     .col-sm-4 
     label.form(for='name') Name 
      input#name.form-control(type='text', placeholder='John Smith...' name='name' required='true' value=(undefined===candidate ? '' : candidate.name)) 
     .col-sm-4 
     label.form(for='signed_offer_letter') Signed Offer Letter:  
      input(type='checkbox', name='signed_offer_letter', checked=(undefined===candidate || candidate.signed_offer_letter!= true ? false:true)) 
    .form-group(style='padding-top:10px') 
     button.btn.btn-sm(type='submit') Update // Nothing happens on submit. 

如果这是值得任何东西,这里是div预代码,工作得很好:

.container 
    h5.panel-title Candidate Details 
    hr 
    form.form-group.input-group-sm(method='POST' action='') 
     label.form(for='name') Name 
     input#name.form-control.input-sm(type='text', placeholder='John Smith...' name='name' required='true' value=(undefined===candidate ? '' : candidate.name)) 
     label.form(for='signed_offer_letter') Signed Offer Letter:  
     input(type='checkbox', name='signed_offer_letter', checked=(undefined===candidate || candidate.signed_offer_letter!= true ? false:true)) 

     .form-group(style='padding-top:10px') 
     button.btn.btn-sm(type='submit') Update 

我缺少什么?好像divs应该没有区别?

+3

不能完全从目测分辨,但它看起来像你的行和形式组的div是形式,而不是儿童的兄弟姐妹。 –

+1

@DanielSchaffer这样做了。现在看起来很明显。谢谢。 –

回答

2

你的注意力不对。表单和div是兄弟,而div应该是表单的孩子。

.container 
    h5.panel-title Candidate Details 
    hr 
    form.form-group.input-group-sm(method='POST' action='') 
     .row 
      .col-sm-4 
      label.form(for='name') Name 
       input#name.form-control(type='text', placeholder='John Smith...' name='name' required='true' value=(undefined===candidate ? '' : candidate.name)) 
      .col-sm-4 
      label.form(for='signed_offer_letter') Signed Offer Letter:  
       input(type='checkbox', name='signed_offer_letter', checked=(undefined===candidate || candidate.signed_offer_letter!= true ? false:true)) 
     .form-group(style='padding-top:10px') 
      button.btn.btn-sm(type='submit') Update // Nothing happens on submit.