bootstrapValidator驗證表單後清除當次驗證的方法
阿新 • • 發佈:2018-11-14
用bootstrapValidator的resetForm()方法:
<!-- // create server begin -->
<div class="modal fade" id="server-create-server-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog modal-create"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="clearValidate('server-create-server-modal-form')"> × </button> <h4 id="headDeptLable" class="modal-title">建立儲存伺服器 </h4> </div> <form id="server-create-server-modal-form" method="post" class="form-horizontal" action=""> <div class="modal-body"> <!-- // modal-body begin --> <div class="form-group"> <label class="col-lg-4 col-md-4 col-sm-4 control-label font-normal align-right">名稱:</label> <div class="col-lg-5 col-md-5 col-sm-5"> <input type="text" class="form-control" id="server-create-server-modal-name" name="serverCreateServerModalName" placeholder="" /> </div> </div> <div class="form-group"> <label class="col-lg-4 col-md-4 col-sm-4 control-label font-normal align-right">型別:</label> <div class="col-lg-5 col-md-5 col-sm-5"> <select id="server-create-server-modal-type" name="serverCreateServerModalType" class="form-control"> <option value="">請選擇</option> <option value="AU">儲存密碼機</option> <option value="CA">伺服器二</option> <option value="FR">伺服器三</option> <option value="DE">伺服器四</option> <option value="IT">伺服器五</option> <option value="JP">伺服器六</option> <option value="GB">伺服器七</option> <option value="US">伺服器八</option> <option value="VN">伺服器九</option> </select> </div> </div> <div class="form-group"> <label class="col-lg-4 col-md-4 col-sm-4 control-label font-normal align-right">IP:</label> <div class="col-lg-5 col-md-5 col-sm-5"> <input type="text" class="form-control" id="server-create-server-modal-ip" name="serverCreateServerModalIp" /> </div> </div> <!-- // modal-body end --> </div> <div class="modal-footer"> <button class="btn btn-success" id="server-create-server-modal-submit" type="submit"> 確 定 </button> <button class="btn btn-default" type="button" data-dismiss="modal" onclick="clearValidate('server-create-server-modal-form')"> 取 消 </button> </div> </form> </div>