Browse Source

Adds new value prop to form validation #3313

pull/4366/merge
Jack Lukic 8 years ago
parent
commit
cf4bab4c37
1 changed files with 9 additions and 2 deletions
  1. 11
      src/definitions/behaviors/form.js

11
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

Loading…
Cancel
Save