From cf4bab4c3723b59726018afd022a172ff9960d54 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Sun, 31 Jul 2016 12:55:06 -0400 Subject: [PATCH] Adds new value prop to form validation #3313 --- src/definitions/behaviors/form.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/definitions/behaviors/form.js b/src/definitions/behaviors/form.js index d40d1688c..21e19ec1a 100644 --- a/src/definitions/behaviors/form.js +++ b/src/definitions/behaviors/form.js @@ -352,10 +352,13 @@ $.fn.form = function(parameters) { get: { ancillaryValue: function(rule) { - if(!rule.type || !module.is.bracketedRule(rule)) { + if(!rule.type || (!rule.value && !module.is.bracketedRule(rule))) { return false; } - return rule.type.match(settings.regExp.bracket)[1] + ''; + return (rule.value !== undefined) + ? rule.value + : rule.type.match(settings.regExp.bracket)[1] + '' + ; }, ruleName: function(rule) { if( module.is.bracketedRule(rule) ) { @@ -883,6 +886,7 @@ $.fn.form = function(parameters) { ? '' : $.trim(value + '') ; + console.log(rule, ancillary); return ruleFunction.call($field, value, ancillary); } }, @@ -1207,6 +1211,9 @@ $.fn.form.settings = { // matches specified regExp regExp: function(value, regExp) { + if(regExp instanceof RegExp) { + return value.match(regExp); + } var regExpParts = regExp.match($.fn.form.settings.regExp.flags), flags