本文实例为大家分享了bootstrapValidator表单验证的具体代码,供大家参考,具体内容如下
1.页面引入css、js
<script type="text/javascript" src="../vendor/jquery/jquery-1.10.2.min.js">
<script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js">
<script type="text/javascript" src="../dist/js/bootstrapValidator.js">
<script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js">
<script type="text/javascript" src="../dist/js/bootstrapValidator.js">
2.页面表单
用户名
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="email" name="email">
</div>
</div>
<div class="form-group">
<label for="alias" class="col-sm-2 control-label">别名</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="alias" name="alias">
</div>
</div>
<div class="form-group">
<label for="personId" class="col-sm-2 control-label">隶属人员</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="personId" name="personId">
</div>
<label for="enabled" class="col-sm-2 control-label">是否可用</label>
<div class="col-sm-4">
<input type="radio" name="enabled" value="true" checked>是
<input type="ra<a href="https://www.jb51.cc/tag/dio/" target="_blank" class="keywords">dio</a>" name="enabled" value="false">否
</div>
</div>
<div class="form-group">
<label for="accountExpired" class="col-sm-3 control-label">账号是否过期</label>
<div class="col-sm-2">
<input type="ra<a href="https://www.jb51.cc/tag/dio/" target="_blank" class="keywords">dio</a>" name="accountExpired" value="true">是
<input type="radio" name="accountExpired" value="false" checked>否
</div>
<label for="accountLocked" class="col-sm-3 control-label">账号是否锁定</label>
<div class="col-sm-2">
<input type="ra<a href="https://www.jb51.cc/tag/dio/" target="_blank" class="keywords">dio</a>" name="accountLocked" value="true">是
<input type="radio" name="accountLocked" value="false" checked>否
</div>
</div>
<div class="form-group">
<label for="credentialsExpired" class="col-sm-3 control-label">密码是否过期</label>
<div class="col-sm-2">
<input type="ra<a href="https://www.jb51.cc/tag/dio/" target="_blank" class="keywords">dio</a>" name="credentialsExpired" value="true">是
<input type="radio" name="credentialsExpired" value="false" checked>否
</div>
<label for="superAdmin" class="col-sm-3 control-label">是否超级<a href="https://www.jb51.cc/tag/guanliyuan/" target="_blank" class="keywords">管理员</a></label>
<div class="col-sm-2">
<input type="ra<a href="https://www.jb51.cc/tag/dio/" target="_blank" class="keywords">dio</a>" name="superAdmin" value="true">是
<input type="radio" name="superAdmin" value="false" checked>否
</div>
</div>
<div class="form-group">
<label for="memo" class="col-sm-2 control-label">备注</label>
<div class="col-sm-10">
<textarea cols="80" rows="3" class="form-control" id="memo" name="memo"></textarea>
</div>
</div>
<div style="width: 250px; margin: 20px auto;">