一、页面引用插件介绍 一个比较详细的规则介绍的中文网站: https://mrbird.cc/BootstrapValidator指南.html https://www.zhuangyan.cn/BootstrapValidator-guide -- bootstrapValidator是一个基于bootstrap的表单验证组件 --> <link rel="stylesheet" href="plug-in/survey/dist/css /<em>bootstrapValidator</em>.css"/> 2、JS插件 <script type="text/javascript" src="plug-in/survey/js/jquery/jquery -- 表单验证组件 --> <script type="text/javascript" src="plug-in/survey/dist/js/<em>bootstrapValidator</em>.js"></script > 二、通用方法介绍 注意:使用bootstrapValidator插件时,需要验证的数据,如:input类型的。
(options),有两种方法调用插件方法: // Get plugin instance var bootstrapValidator = $(form).data('bootstrapValidator '); // and then call method bootstrapValidator.methodName(parameters) 要么: $(form).bootstrapValidator $(form).bootstrapValidator(options); $(form).data('bootstrapValidator').resetForm(); revalidateField (field); // Or $(form).bootstrapValidator('updateStatus', field, 'NOT_VALIDATED') .bootstrapValidator $(form).bootstrapValidator(options).bootstrapValidator('validate'); // or $(form).bootstrapValidator
.); $(form).submit(); //这两个不能同时使用,要不然不会提交表单到后台. }) bootstrapValidator插件与form.submit()事件冲突,不知道为什么就是验证完之后就是不能提交表单 同时在前端应该判断好bootstrapValidator是否验证通过再去提交表单。也就是说先判断bootstrapValidator.IsValid(),再去提交表单。 最好销毁bootstrapvalidator插件并重新加载验证的代码: $("form").data("bootstrapValidator").destory(); $("form").data(" bootstrapValidator", null); 参考:http://www.cnblogs.com/RegicideGod/archive/2013/02/04/2892451.html
地址 校验要用的到组件叫bootstrapvalidator。 bootstrapvalidator源码: https://github.com/nghuuphuoc/bootstrapvalidator 正文 文件引入 下载后需要引入jquery,bootstrap.min.js ,bootstrap.min.css以及bootstrapvalidator相关的js和css。 /js/bootstrapValidator.min.js"></script> <link href="/Content/<em>bootstrapValidator</em>/css/<em>bootstrapValidator</em>.min.css = $("#formLogin").data("bootstrapValidator").validate(); if (bootstrapValidator.isValid()){
initial-scale=1.0"> <link href="css/bootstrap.css" rel="stylesheet" type="text/css"> <link href="css/<em>bootstrapValidator</em>.min.css /code.jquery.com/jquery.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/<em>bootstrapValidator</em>.min.js ('form').<em>bootstrapValidator</em>({ message: 'This value is not valid', feedbackIcons: { valid: 'glyphicon
initial-scale=1.0"> <link href="css/bootstrap.css" rel="stylesheet" type="text/css"> <link href="css/<em>bootstrapValidator</em>.min.css /code.jquery.com/jquery.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/<em>bootstrapValidator</em>.min.js "submit" name="submit" class="btn btn-primary">Submit</button>
form>
需要载入的 js css 文件保存在 yun.seven77.pw/ 实测可以使用的 demo bootstrapvalidator-master,下载地址在google下载下面。
编写form表单 data-bv-{校验规则},规则可以自定义,参考bootstrapValidator.extends.js。 注意提交按钮是submit类型。 ? ? 提交表单 ? 效果 ?
前端框架 http://getbootstrap.com/ Bootstrap-table Bootstrap数据表格 http://bootstrap-table.wenzhixin.net.cn/ BootstrapValidator 表单验证 http://bootstrapvalidator.com/ Font-awesome 字体图标 http://fontawesome.io/ Waves 点击效果插件 https://github.com
$('.form-horizontal').bootstrapValidator({ message : 'This value is not valid',
e.target); // Get the BootstrapValidatorinstance // var bv =$form.data('bootstrapValidator
前端框架 http://getbootstrap.com/ Bootstrap-table Bootstrap数据表格 http://bootstrap-table.wenzhixin.net.cn/ BootstrapValidator 表单验证 http://bootstrapvalidator.com/ Font-awesome 字体图标 http://fontawesome.io/ Waves 点击效果插件 https://github.com
>
在tp5框架的public目录下有一static目录,该目录就是用来存放静态资源的,包括第三方的前台框架boostrap 下载三个文件 1.bootstrap-3.3.7-dist.zip 2. bootstrapvalidator
form>
当然我们也可以使用bootstrapValidator验证。
2.6.1 工具类:Apache Commons,Jackson 2.2,fastjson 1.2.20 2,前端 JS框架:jQuery的 表格插件:Bootstrap Table 表单验证插件:BootstrapValidator
这里介绍一款很好用的表单验证插件,formvalidation,实际上也是bootstrap的一个插件,之前叫bootstrapValidator,现在独立出来了。
官网 BootstrapValidator:是验证表单域中最好的 jQuery 插件。要与 Bootstrap 3 一起使用。官网 is.js:检查类型、正则表达式、是否存在、时间等。