手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >bootstrapValidator自定验证方法写法
bootstrapValidator自定验证方法写法
摘要:本文实例为大家分享了bootstrapValidator自定验证方法写法,供大家参考,具体内容如下//表单验证issueInvoiceFor...

本文实例为大家分享了bootstrapValidator自定验证方法写法,供大家参考,具体内容如下

//表单验证 issueInvoiceForm.validation = function(){ $('#issueInvoiceForm').on('init.field.bv', function(e, data) { var $icon = data.element.data('bv.icon'), options = data.bv.getOptions(), // Entire options validators = data.bv.getOptions(data.field).validators; // The field validators if (validators.notEmpty && options.feedbackIcons && options.feedbackIcons.required) { $icon.addClass(options.feedbackIcons.required).show(); } }).bootstrapValidator({ container:'popover', feedbackIcons: { required: 'glyphicon glyphicon-asterisk requiredStar', valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { invoiceDate:{validators: {notEmpty: {message: '开票日期不能为空'}}},//开票日期 code:{validators: {notEmpty: {message: '发票编码不能为空'}}}, amount:{ validators:{ notEmpty: {message: '发票金额不能为空'}, numeric: {message: '发票金额只能输入数字'}, callback: { message: '开票金额小于选中金额', callback: function(value, validator) { return false; } } } }, taxRate:{ validators:{ notEmpty: {message: '税率不能为空'}, numeric: {message: '税率只能输入数字'} } }, taxAmount:{ validators:{ notEmpty: {message: '税额不能为空'}, numeric: {message: '税额只能输入数字'} } }, },group:'.validateDiv' }).on('success.form.bv', issueInvoiceForm.issueInvoiceFormBtn).on('error.form.bv',function(){ $("#issueInvoiceFormBtn").removeAttr("disabled");//将保存按钮去除disabled $(".has-error:visible:first").find(":input").focus(); }); };

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持查字典教程网。

【bootstrapValidator自定验证方法写法】相关文章:

javascript常用的方法分享

js获取滚动距离的方法

jQuery实现dialog设置focus焦点的方法

jQuery实现自动滚动到页面顶端的方法

Jquery实现动态切换图片的方法

jQuery取消ajax请求的方法

js中跨域方法原理详解

用JavaScript实现对话框的教程

js+html5操作sqlite数据库的方法

mouse_on_title.js

精品推荐
分类导航