本文實(shí)例為大家分享了bootstrapvalidator自定驗(yàn)證方法寫(xiě)法,供大家參考,具體內(nèi)容如下
//表單驗(yàn)證 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: '開(kāi)票日期不能為空'}}},//開(kāi)票日期 code:{validators: {notEmpty: {message: '發(fā)票編碼不能為空'}}}, amount:{ validators:{ notEmpty: {message: '發(fā)票金額不能為空'}, numeric: {message: '發(fā)票金額只能輸入數(shù)字'}, callback: { message: '開(kāi)票金額小于選中金額', callback: function(value, validator) { return false; } } } }, taxRate:{ validators:{ notEmpty: {message: '稅率不能為空'}, numeric: {message: '稅率只能輸入數(shù)字'} } }, taxAmount:{ validators:{ notEmpty: {message: '稅額不能為空'}, numeric: {message: '稅額只能輸入數(shù)字'} } }, },group:'.validateDiv' }).on('success.form.bv', issueInvoiceForm.issueInvoiceFormBtn).on('error.form.bv',function(){ $("#issueInvoiceFormBtn").removeAttr("disabled");//將保存按鈕去除disabled $(".has-error:visible:first").find(":input").focus(); }); };
每個(gè)人都需要一臺(tái)速度更快、更穩(wěn)定的 PC。隨著時(shí)間的推移,垃圾文件、舊注冊(cè)表數(shù)據(jù)和不必要的后臺(tái)進(jìn)程會(huì)占用資源并降低性能。幸運(yùn)的是,許多工具可以讓 Windows 保持平穩(wěn)運(yùn)行。
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號(hào)
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://m.miracleart.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)