posabsolute/jQuery-Validation-Engine — Issue #284: Missing Rule Size
Author: standula
Created: 2012-02-21 09:24:22+00:00
State: open

Hi,

plugin has rules for minSize, maxSize but there is no rule for eqauls Size
Code
case "size":
errorMsg = methods._size(field, rules, i, options);
break;

/**
* Check the size (in characters)
*
* @param {jqObject} field
* @param {Array[String]} rules
* @param {int} i rules index
* @param {Map}
* user options
* @return an error string if validation failed
*/
_size: function(field, rules, i, options) {
var min = rules[i + 1];

if (field.val().length < min) {
var rule = options.allrules.Size;
return rule.alertText + min + rule.alertText2;
}
}