处理美化表单但似乎无法弄清楚将表单分成不同divs
时导致的错误。当表单嵌套在单个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.
如果它有价值,这里的pre-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
应该没有区别?
答案 0 :(得分: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.