bootstrapValidator.min.js 20 KB

123456789101112
  1. /**
  2. * BootstrapValidator (https://github.com/nghuuphuoc/bootstrapvalidator)
  3. *
  4. * A jQuery plugin to validate form fields. Use with Bootstrap 3
  5. *
  6. * @version v0.3.2
  7. * @author https://twitter.com/nghuuphuoc
  8. * @copyright (c) 2013 - 2014 Nguyen Huu Phuoc
  9. * @license MIT
  10. */
  11. !function(a){var b=function(c,d){this.$form=a(c),this.options=a.extend({},b.DEFAULT_OPTIONS,d),this.dfds={},this.results={},this.invalidField=null,this.$submitButton=null,this._init(),this.STATUS_NOT_VALIDATED="NOT_VALIDATED",this.STATUS_VALIDATING="VALIDATING",this.STATUS_INVALID="INVALID",this.STATUS_VALID="VALID"};b.DEFAULT_OPTIONS={elementClass:"bootstrap-validator-form",message:"This value is not valid",feedbackIcons:{valid:null,invalid:null,validating:null},submitButtons:'button[type="submit"]',submitHandler:null,live:"enabled",fields:null},b.prototype={constructor:b,_init:function(){if(null!=this.options.fields){var b=this;this.$form.attr("novalidate","novalidate").addClass(this.options.elementClass).on("submit.bootstrapValidator",function(a){a.preventDefault(),b.validate()}).find(this.options.submitButtons).on("click",function(){b.$submitButton=a(this)});for(var c in this.options.fields)this._initField(c);this._setLiveValidating()}},_initField:function(b){if(null!=this.options.fields[b]&&null!=this.options.fields[b].validators){this.dfds[b]={},this.results[b]={};var c=this.getFieldElements(b);if(null==c)return delete this.options.fields[b],void delete this.dfds[b];c.attr("data-bv-field",b);var d=a(c[0]),e=d.parents(".form-group"),f=this.options.fields[b].container?e.find(this.options.fields[b].container):this._getMessageContainer(d);d.data("bootstrapValidator.messageContainer",f);for(var g in this.options.fields[b].validators)a.fn.bootstrapValidator.validators[g]?(this.results[b][g]=this.STATUS_NOT_VALIDATED,a("<small/>").css("display","none").attr("data-bv-validator",g).html(this.options.fields[b].validators[g].message||this.options.message).addClass("help-block").appendTo(f)):delete this.options.fields[b].validators[g];if(this.options.feedbackIcons&&this.options.feedbackIcons.validating&&this.options.feedbackIcons.invalid&&this.options.feedbackIcons.valid){e.addClass("has-feedback");var h=a("<i/>").css("display","none").addClass("form-control-feedback").attr("data-bv-field",b).insertAfter(a(c[c.length-1]));0==e.find("label").length&&h.css("top",0)}null==this.options.fields[b].enabled&&(this.options.fields[b].enabled=!0);var i=this,j=c.attr("type"),k="radio"==j||"checkbox"==j||"SELECT"==c[0].tagName?"change":"keyup";c.on(k+".bootstrapValidator",function(){i.updateStatus(d,i.STATUS_NOT_VALIDATED,null)})}},_getMessageContainer:function(a){var b=a.parent();if(b.hasClass("form-group"))return b;var c=b.attr("class");if(!c)return this._getMessageContainer(b);c=c.split(" ");for(var d=c.length,e=0;d>e;e++)if(/^col-(xs|sm|md|lg)-\d+$/.test(c[e])||/^col-(xs|sm|md|lg)-offset-\d+$/.test(c[e]))return b;return this._getMessageContainer(b)},_setLiveValidating:function(){if("enabled"==this.options.live){var a=this;for(var b in this.options.fields)!function(b){var c=a.getFieldElements(b);if(c){var d=c.attr("type"),e="radio"==d||"checkbox"==d||"SELECT"==c[0].tagName?"change":"keyup";c.on(e+".bootstrapValidator",function(){a.validateField(b)})}}(b)}},_disableSubmitButtons:function(a){a?"disabled"!=this.options.live&&this.$form.find(this.options.submitButtons).attr("disabled","disabled"):this.$form.find(this.options.submitButtons).removeAttr("disabled")},_submit:function(){return this.isValid()?(this._disableSubmitButtons(!0),void(this.options.submitHandler&&"function"==typeof this.options.submitHandler?this.options.submitHandler.call(this,this,this.$form,this.$submitButton):this.$form.off("submit.bootstrapValidator").submit())):("submitted"==this.options.live&&(this.options.live="enabled",this._setLiveValidating()),void(this.invalidField&&this.getFieldElements(this.invalidField).focus()))},getFieldElements:function(a){var b=this.$form.find(this.options.fields[a].selector||'[name="'+a+'"]');return 0==b.length?null:b},validate:function(){if(!this.options.fields)return this;this._disableSubmitButtons(!0);for(var a in this.options.fields)this.validateField(a);return this._submit(),this},validateField:function(b){if(this.options.fields[b].enabled){var c,d,e=this,f=this.getFieldElements(b),g=a(f[0]),h=this.options.fields[b].validators;if(1==f.length&&f.is(":disabled"))return delete this.options.fields[b],void delete this.dfds[b];for(c in h)this.dfds[b][c]&&this.dfds[b][c].reject(),this.results[b][c]!=this.STATUS_VALID&&this.results[b][c]!=this.STATUS_INVALID&&(this.results[b][c]=this.STATUS_VALIDATING,d=a.fn.bootstrapValidator.validators[c].validate(this,g,h[c]),"object"==typeof d?(this.updateStatus(g,this.STATUS_VALIDATING,c),this.dfds[b][c]=d,d.done(function(a,c){delete e.dfds[b][c],e.updateStatus(g,a?e.STATUS_VALID:e.STATUS_INVALID,c),a&&"disabled"==e.options.live&&e._submit()})):"boolean"==typeof d&&this.updateStatus(g,d?this.STATUS_VALID:this.STATUS_INVALID,c))}},isValid:function(){var a,b;for(a in this.results)if(this.options.fields[a].enabled)for(b in this.results[a]){if(this.results[a][b]==this.STATUS_NOT_VALIDATED||this.results[a][b]==this.STATUS_VALIDATING)return!1;if(this.results[a][b]==this.STATUS_INVALID)return this.invalidField=a,!1}return!0},updateStatus:function(b,c,d){var e="string"==typeof b?this.getFieldElements(b):b,f=this,b=e.attr("data-bv-field"),g=e.parents(".form-group"),h=e.data("bootstrapValidator.messageContainer"),i=h.find(".help-block[data-bv-validator]"),j=g.find('.form-control-feedback[data-bv-field="'+b+'"]');if(d)this.results[b][d]=c;else for(var k in this.options.fields[b].validators)this.results[b][k]=c;switch(c){case this.STATUS_VALIDATING:this._disableSubmitButtons(!0),g.removeClass("has-success").removeClass("has-error"),d?i.filter('.help-block[data-bv-validator="'+d+'"]').hide():i.hide(),j&&j.removeClass(this.options.feedbackIcons.valid).removeClass(this.options.feedbackIcons.invalid).addClass(this.options.feedbackIcons.validating).show();break;case this.STATUS_INVALID:this._disableSubmitButtons(!0),g.removeClass("has-success").addClass("has-error"),d?i.filter('[data-bv-validator="'+d+'"]').show():i.show(),j&&j.removeClass(this.options.feedbackIcons.valid).removeClass(this.options.feedbackIcons.validating).addClass(this.options.feedbackIcons.invalid).show();break;case this.STATUS_VALID:d?i.filter('[data-bv-validator="'+d+'"]').hide():i.hide(),0==i.filter(function(){var c=a(this).css("display"),d=a(this).attr("data-bv-validator");return"block"==c||f.results[b][d]!=f.STATUS_VALID}).length&&(this._disableSubmitButtons(!1),g.removeClass("has-error").addClass("has-success"),j&&j.removeClass(this.options.feedbackIcons.invalid).removeClass(this.options.feedbackIcons.validating).addClass(this.options.feedbackIcons.valid).show());break;case this.STATUS_NOT_VALIDATED:default:this._disableSubmitButtons(!1),g.removeClass("has-success").removeClass("has-error"),d?i.filter('.help-block[data-bv-validator="'+d+'"]').hide():i.hide(),j&&j.removeClass(this.options.feedbackIcons.valid).removeClass(this.options.feedbackIcons.invalid).removeClass(this.options.feedbackIcons.validating).hide()}return this},resetForm:function(a){var b,c,d;for(b in this.options.fields)this.dfds[b]={},this.results[b]={},c=this.getFieldElements(b),this.updateStatus(c,this.STATUS_NOT_VALIDATED,null),a&&(d=c.attr("type"),"radio"==d||"checkbox"==d?c.removeAttr("checked").removeAttr("selected"):c.val(""));return this.invalidField=null,this.$submitButton=null,this._disableSubmitButtons(!1),this},enableFieldValidators:function(a,b){return this.options.fields[a].enabled=b,this.updateStatus(a,this.STATUS_NOT_VALIDATED,null),this}},a.fn.bootstrapValidator=function(c){return this.each(function(){var d=a(this),e=d.data("bootstrapValidator");e||d.data("bootstrapValidator",e=new b(this,c)),"string"==typeof c&&e[c]()})},a.fn.bootstrapValidator.validators={},a.fn.bootstrapValidator.Constructor=b}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.base64={validate:function(a,b){var c=b.val();return""==c?!0:/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.between={validate:function(a,b,c){var d=b.val();return""==d?!0:(d=parseFloat(d),c.inclusive===!0?d>c.min&&d<c.max:d>=c.min&&d<=c.max)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.callback={validate:function(b,c,d){var e=c.val();if(d.callback&&"function"==typeof d.callback){var f=new a.Deferred;return f.resolve(d.callback.call(this,e,b),"callback"),f}return!0}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.choice={validate:function(a,b,c){var d=a.getFieldElements(b.attr("data-bv-field")).filter(":checked").length;return c.min&&d<c.min||c.max&&d>c.max?!1:!0}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.creditCard={validate:function(a,b){var c=b.val();if(""==c)return!0;if(/[^0-9-\s]+/.test(c))return!1;c=c.replace(/\D/g,"");for(var d=0,e=0,f=!1,g=c.length,h=g-1;h>=0;h--)e=parseInt(c.charAt(h),10),f&&(e*=2)>9&&(e-=9),d+=e,f=!f;if(d%10!=0)return!1;var i,j,k={AMERICAN_EXPRESS:{length:[15],prefix:["34","37"]},DINERS_CLUB:{length:[14],prefix:["300","301","302","303","304","305","36"]},DINERS_CLUB_US:{length:[16],prefix:["54","55"]},DISCOVER:{length:[16],prefix:["6011","622126","622127","622128","622129","62213","62214","62215","62216","62217","62218","62219","6222","6223","6224","6225","6226","6227","6228","62290","62291","622920","622921","622922","622923","622924","622925","644","645","646","647","648","649","65"]},JCB:{length:[16],prefix:["3528","3529","353","354","355","356","357","358"]},LASER:{length:[16,17,18,19],prefix:["3528","3529","353","354","355","356","357","358"]},MAESTRO:{length:[12,13,14,15,16,17,18,19],prefix:["5018","5020","5038","6304","6759","6761","6762","6763","6764","6765","6766"]},MASTERCARD:{length:[16],prefix:["51","52","53","54","55"]},SOLO:{length:[16,18,19],prefix:["6334","6767"]},UNIONPAY:{length:[16,17,18,19],prefix:["622126","622127","622128","622129","62213","62214","62215","62216","62217","62218","62219","6222","6223","6224","6225","6226","6227","6228","62290","62291","622920","622921","622922","622923","622924","622925"]},VISA:{length:[16],prefix:["4"]}};for(i in k)for(j in k[i].prefix)if(c.substr(0,k[i].prefix[j].length)==k[i].prefix[j]&&-1!=k[i].length.indexOf(c.length))return!0;return!1}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.cvv={validate:function(a,b,c){var d=b.val();if(""==d)return!0;if(!/^[0-9]{3,4}$/.test(d))return!1;if(!c.creditCardField)return!0;var e=a.getFieldElements(c.creditCardField).val();if(""==e)return!0;var f,g,h={AMERICAN_EXPRESS:{length:[15],prefix:["34","37"]},DINERS_CLUB:{length:[14],prefix:["300","301","302","303","304","305","36"]},DINERS_CLUB_US:{length:[16],prefix:["54","55"]},DISCOVER:{length:[16],prefix:["6011","622126","622127","622128","622129","62213","62214","62215","62216","62217","62218","62219","6222","6223","6224","6225","6226","6227","6228","62290","62291","622920","622921","622922","622923","622924","622925","644","645","646","647","648","649","65"]},JCB:{length:[16],prefix:["3528","3529","353","354","355","356","357","358"]},LASER:{length:[16,17,18,19],prefix:["3528","3529","353","354","355","356","357","358"]},MAESTRO:{length:[12,13,14,15,16,17,18,19],prefix:["5018","5020","5038","6304","6759","6761","6762","6763","6764","6765","6766"]},MASTERCARD:{length:[16],prefix:["51","52","53","54","55"]},SOLO:{length:[16,18,19],prefix:["6334","6767"]},UNIONPAY:{length:[16,17,18,19],prefix:["622126","622127","622128","622129","62213","62214","62215","62216","62217","62218","62219","6222","6223","6224","6225","6226","6227","6228","62290","62291","622920","622921","622922","622923","622924","622925"]},VISA:{length:[16],prefix:["4"]}},i=null;for(f in h)for(g in h[f].prefix)if(e.substr(0,h[f].prefix[g].length)==h[f].prefix[g]&&-1!=h[f].length.indexOf(e.length)){i=f;break}return null==i?!1:"AMERICAN_EXPRESS"==i?4==d.length:3==d.length}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.date={validate:function(a,b,c){var d=b.val();if(""==d)return!0;c.format=c.format||"MM/DD/YYYY";var e=-1!=c.format.indexOf("/")?"/":-1!=c.format.indexOf("-")?"-":null;if(null==e)return!1;var f,g,h,i,j=null,k=null;switch(!0){case"/"==e&&(i=d.match(/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/i))&&"YYYY/DD/MM"==c.format:case"-"==e&&(i=d.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/i))&&"YYYY-DD-MM"==c.format:h=i[1],g=i[2],f=i[3];break;case"/"==e&&(i=d.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/i))&&"DD/MM/YYYY"==c.format:case"-"==e&&(i=d.match(/^(\d{1,2})-(\d{1,2})-(\d{4})$/i))&&"DD-MM-YYYY"==c.format:g=i[1],f=i[2],h=i[3];break;case"/"==e&&(i=d.match(/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/i))&&"YYYY/MM/DD"==c.format:case"-"==e&&(i=d.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/i))&&"YYYY-MM-DD"==c.format:h=i[1],f=i[2],g=i[3];break;case"/"==e&&(i=d.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/i))&&"MM/DD/YYYY"==c.format:case"-"==e&&(i=d.match(/^(\d{1,2})-(\d{1,2})-(\d{4})$/i))&&"MM-DD-YYYY"==c.format:f=i[1],g=i[2],h=i[3];break;case"/"==e&&(i=d.match(/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})\s+(AM|PM)$/i))&&"YYYY/DD/MM h:m A"==c.format:case"-"==e&&(i=d.match(/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})\s+(AM|PM)$/i))&&"YYYY-DD-MM h:m A"==c.format:h=i[1],g=i[2],f=i[3],k=i[4],j=i[5];break;case"/"==e&&(i=d.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2}):(\d{1,2})\s+(AM|PM)$/i))&&"DD/MM/YYYY h:m A"==c.format:case"-"==e&&(i=d.match(/^(\d{1,2})-(\d{1,2})-(\d{4})\s+(\d{1,2}):(\d{1,2})\s+(AM|PM)$/i))&&"DD-MM-YYYY h:m A"==c.format:g=i[1],f=i[2],h=i[3],k=i[4],j=i[5];break;case"/"==e&&(i=d.match(/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})\s+(AM|PM)$/i))&&"YYYY/MM/DD h:m A"==c.format:case"-"==e&&(i=d.match(/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})\s+(AM|PM)$/i))&&"YYYY-MM-DD h:m A"==c.format:h=i[1],f=i[2],g=i[3],k=i[4],j=i[5];break;case"/"==e&&(i=d.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2}):(\d{1,2})\s+(AM|PM)$/i))&&"MM/DD/YYYY h:m A"==c.format:case"-"==e&&(i=d.match(/^(\d{1,2})-(\d{1,2})-(\d{4})\s+(\d{1,2}):(\d{1,2})\s+(AM|PM)$/i))&&"MM-DD-YYYY h:m A"==c.format:f=i[1],g=i[2],h=i[3],k=i[4],j=i[5];break;default:return!1}if(k&&j&&(k=parseInt(k,10),j=parseInt(j,10),1>k||k>12||0>j||j>59))return!1;if(g=parseInt(g,10),f=parseInt(f,10),h=parseInt(h,10),1e3>h||h>9999||0==f||f>12)return!1;var l=[31,28,31,30,31,30,31,31,30,31,30,31];return(h%400==0||h%100!=0&&h%4==0)&&(l[1]=29),g>0&&g<=l[f-1]}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.different={validate:function(a,b,c){var d=b.val();if(""==d)return!0;var e=a.getFieldElements(c.field);return null==e?!0:d!=e.val()?(a.updateStatus(e,a.STATUS_VALID,"different"),!0):!1}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.digits={validate:function(a,b){var c=b.val();return""==c?!0:/^\d+$/.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.emailAddress={validate:function(a,b){var c=b.val();if(""==c)return!0;var d=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return d.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.greaterThan={validate:function(a,b,c){var d=b.val();return""==d?!0:(d=parseFloat(d),c.inclusive===!0?d>c.value:d>=c.value)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.hexColor={validate:function(a,b){var c=b.val();return""==c?!0:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.identical={validate:function(a,b,c){var d=b.val();if(""==d)return!0;var e=a.getFieldElements(c.field);return null==e?!0:d==e.val()?(a.updateStatus(e,a.STATUS_VALID,"identical"),!0):!1}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.ip={validate:function(b,c,d){var e=c.val();return""==e?!0:(d=a.extend({},{ipv4:!0,ipv6:!0},d),d.ipv4?/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(e):d.ipv6?/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/.test(str):!1)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.isbn={validate:function(a,b){var c=b.val();if(""==c)return!0;c=c.replace(/[^\dX]/gi,"");var d,e=c.split(""),f=0;switch(e.length){case 10:f=0;for(var g=0;9>g;g++)f+=(10-g)*parseInt(e[g]);return d=11-f%11,11==d?d=0:10==d&&(d="X"),d==e[9];case 13:f=0;for(var g=0;12>g;g++)f+=g%2==0?parseInt(e[g]):3*parseInt(e[g]);return d=10-f%10,10==d&&(d="0"),d==e[12];default:return!1}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.lessThan={validate:function(a,b,c){var d=b.val();return""==d?!0:(d=parseFloat(d),c.inclusive===!0?d<c.value:d<=c.value)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.mac={validate:function(a,b){var c=b.val();return""==c?!0:/^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$/.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.notEmpty={validate:function(b,c){var d=c.attr("type");return"radio"==d||"checkbox"==d?b.getFieldElements(c.attr("data-bv-field")).filter(":checked").length>0:""!=a.trim(c.val())}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.phone={validate:function(a,b,c){var d=b.val();if(""==d)return!0;switch(c.country=c.country||"US",c.country.toUpperCase()){case"US":default:return d=d.replace(/\(|\)|\s+/g,""),/^(?:1\-?)?(\d{3})[\-\.]?(\d{3})[\-\.]?(\d{4})$/.test(d)}}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.regexp={validate:function(a,b,c){var d=b.val();return""==d?!0:c.regexp.test(d)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.remote={validate:function(b,c,d){var e=c.val();if(""==e)return!0;var f=c.attr("data-bv-field"),g=d.data;null==g&&(g={}),"function"==typeof g&&(g=g.call(this,b)),g[f]=e;var h=new a.Deferred,i=a.ajax({type:"POST",url:d.url,dataType:"json",data:g});return i.then(function(a){h.resolve(a.valid===!0||"true"===a.valid,"remote")}),h.fail(function(){i.abort()}),h}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.step={validate:function(b,c,d){var e=c.val();if(""==e)return!0;if(d=a.extend({},{baseValue:0,step:1},d),e=parseFloat(e),isNaN(e)||!isFinite(e))return!1;var f=function(a,b){var c=Math.pow(10,b);a*=c;var d=a>0|-(0>a),e=a%1===.5*d;return e?(Math.floor(a)+(d>0))/c:Math.round(a)/c},g=function(a,b){if(0==b)return 1;var c=(a+"").split("."),d=(b+"").split("."),e=(1==c.length?0:c[1].length)+(1==d.length?0:d[1].length);return f(a-b*Math.floor(a/b),e)},h=g(e-d.baseValue,d.step);return 0==h||h==d.step}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.stringLength={validate:function(b,c,d){var e=c.val();if(""==e)return!0;var f=a.trim(e).length;return d.min&&f<d.min||d.max&&f>d.max?!1:!0}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.uri={validate:function(a,b){var c=b.val();if(""==c)return!0;var d=new RegExp("^(?:(?:https?|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:/[^\\s]*)?$","i");return d.test(c)}}}(window.jQuery),function(a){a.fn.bootstrapValidator.validators.zipCode={validate:function(a,b,c){var d=b.val();if(""==d||!c.country)return!0;switch(c.country=c.country||"US",c.country.toUpperCase()){case"DK":return/^(DK(-|\s)?)?\d{4}$/i.test(d);case"SE":return/^(S-)?\d{3}\s?\d{2}$/i.test(d);case"US":default:return/^\d{5}([\-]\d{4})?$/.test(d)}}}}(window.jQuery);