/** * jQuery Validation Plugin 1.9.0 * * http://web.archive.orghttp://bassistance.de/jquery-plugins/jquery-plugin-validation/ * http://web.archive.orghttp://docs.jquery.com/Plugins/Validation * * Copyright (c) 2006 - 2011 Jörn Zaefferer * * Dual licensed under the MIT and GPL licenses: * http://web.archive.orghttp://www.opensource.org/licenses/mit-license.php * http://web.archive.orghttp://www.gnu.org/licenses/gpl.html */ (function(c) { c.extend(c.fn, { validate : function(a) { if (this.length) { var b = c.data(this[0], "validator"); if (b) return b; this.attr("novalidate", "novalidate"); b = new c.validator(a, this[0]); c.data(this[0], "validator", b); if (b.settings.onsubmit) { a = this.find("input, button"); a.filter(".cancel").click(function() { b.cancelSubmit = true }); b.settings.submitHandler && a.filter(":submit").click(function() { b.submitButton = this }); this.submit(function(d) { function e() { if (b.settings.submitHandler) { if (b.submitButton) var f = c("").attr("name", b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm); b.settings.submitHandler.call(b, b.currentForm); b.submitButton && f.remove(); return false } return true } b.settings.debug && d.preventDefault(); if (b.cancelSubmit) { b.cancelSubmit = false; return e() } if (b.form()) { if (b.pendingRequest) { b.formSubmitted = true; return false } return e() } else { b.focusInvalid(); return false } }) } return b } else a && a.debug && window.console && console.warn("nothing selected, can't validate, returning nothing") }, valid : function() { if (c(this[0]).is("form")) return this.validate().form(); else { var a = true, b = c(this[0].form).validate(); this.each(function() { a &= b.element(this) }); return a } }, removeAttrs : function(a) { var b = {}, d = this; c.each(a.split(/\s/), function(e, f) { b[f] = d.attr(f); d.removeAttr(f) }); return b }, rules : function(a, b) { var d = this[0]; if (a) { var e = c.data(d.form, "validator").settings, f = e.rules, g = c.validator.staticRules(d); switch(a) { case "add": c.extend(g, c.validator.normalizeRule(b)); f[d.name] = g; if (b.messages) e.messages[d.name] = c.extend(e.messages[d.name], b.messages); break; case "remove": if (!b) { delete f[d.name]; return g } var h = {}; c.each(b.split(/\s/), function(j, i) { h[i] = g[i]; delete g[i] }); return h } } d = c.validator.normalizeRules(c.extend({}, c.validator.metadataRules(d), c.validator.classRules(d), c.validator.attributeRules(d), c.validator.staticRules(d)), d); if (d.required) { e = d.required; delete d.required; d = c.extend({ required : e }, d) } return d } }); c.extend(c.expr[":"], { blank : function(a) { return !c.trim("" + a.value) }, filled : function(a) { return !!c.trim("" + a.value) }, unchecked : function(a) { return !a.checked } }); c.validator = function(a, b) { this.settings = c.extend(true, {}, c.validator.defaults, a); this.currentForm = b; this.init() }; c.validator.format = function(a, b) { if (arguments.length == 1) return function() { var d = c.makeArray(arguments); d.unshift(a); return c.validator.format.apply(this, d) }; if (arguments.length > 2 && b.constructor != Array) b = c.makeArray(arguments).slice(1); if (b.constructor != Array) b = [b]; c.each(b, function(d, e) { a = a.replace(RegExp("\\{" + d + "\\}", "g"), e) }); return a }; c.extend(c.validator, { defaults : { messages : {}, groups : {}, rules : {}, errorClass : "error_field", validClass : "valid", errorElement : "label", focusInvalid : true, errorContainer : c([]), errorLabelContainer : c([]), onsubmit : true, ignore : ":hidden", ignoreTitle : false, onfocusin : function(a) { this.lastActive = a; if (this.settings.focusCleanup && !this.blockFocusCleanup) { this.settings.unhighlight && this.settings.unhighlight.call(this, a, this.settings.errorClass, this.settings.validClass); this.addWrapper(this.errorsFor(a)).hide() } }, onfocusout : function(a) { if (!this.checkable(a) && (a.name in this.submitted || !this.optional(a))) this.element(a) }, onkeyup : function(a) { if (a.name in this.submitted || a == this.lastElement) this.element(a) }, onclick : function(a) { if (a.name in this.submitted) this.element(a); else a.parentNode.name in this.submitted && this.element(a.parentNode) }, highlight : function(a, b, d) { a.type === "radio" ? this.findByName(a.name).addClass(b).removeClass(d) : c(a).addClass(b).removeClass(d) }, unhighlight : function(a, b, d) { a.type === "radio" ? this.findByName(a.name).removeClass(b).addClass(d) : c(a).removeClass(b).addClass(d) } }, setDefaults : function(a) { c.extend(c.validator.defaults, a) }, messages : { required : "This field is required.", remote : "Please fix this field.", email : "Please enter a valid email address.", url : "Please enter a valid URL.", date : "Please enter a valid date.", dateISO : "Please enter a valid date (ISO).", number : "Please enter a valid number.", digits : "Please enter only digits.", creditcard : "Please enter a valid credit card number.", equalTo : "Please enter the same value again.", accept : "Please enter a value with a valid extension.", maxlength : c.validator.format("Please enter no more than {0} characters."), minlength : c.validator.format("Please enter at least {0} characters."), rangelength : c.validator.format("Please enter a value between {0} and {1} characters long."), range : c.validator.format("Please enter a value between {0} and {1}."), max : c.validator.format("Please enter a value less than or equal to {0}."), min : c.validator.format("Please enter a value greater than or equal to {0}.") }, autoCreateRanges : false, prototype : { init : function() { function a(e) { var f = c.data(this[0].form, "validator"), g = "on" + e.type.replace(/^validate/, ""); f.settings[g] && f.settings[g].call(f, this[0], e) } this.labelContainer = c(this.settings.errorLabelContainer); this.errorContext = this.labelContainer.length && this.labelContainer || c(this.currentForm); this.containers = c(this.settings.errorContainer).add(this.settings.errorLabelContainer); this.submitted = {}; this.valueCache = {}; this.pendingRequest = 0; this.pending = {}; this.invalid = {}; this.reset(); var b = this.groups = {}; c.each(this.settings.groups, function(e, f) { c.each(f.split(/\s/), function(g, h) { b[h] = e }) }); var d = this.settings.rules; c.each(d, function(e, f) { d[