From d605078e71245ad10f8476087a76bee932616cb0 Mon Sep 17 00:00:00 2001 From: jlukic Date: Wed, 30 Oct 2013 12:51:53 -0400 Subject: [PATCH] Fixes #283 issue with regexp not escaping on validation --- src/modules/behavior/form.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/behavior/form.js b/src/modules/behavior/form.js index ec52708fe..f523b750b 100755 --- a/src/modules/behavior/form.js +++ b/src/modules/behavior/form.js @@ -360,7 +360,7 @@ $.fn.form = function(fields, parameters) { var $field = module.get.field(field.identifier), type = validation.type, - value = $field.val(), + value = $field.val() + '', bracketRegExp = /\[(.*?)\]/i, bracket = bracketRegExp.exec(type), @@ -370,7 +370,7 @@ $.fn.form = function(fields, parameters) { ; // if bracket notation is used, pass in extra parameters if(bracket !== undefined && bracket !== null) { - ancillary = bracket[1]; + ancillary = '' + bracket[1]; functionType = type.replace(bracket[0], ''); isValid = $.proxy(settings.rules[functionType], $module)(value, ancillary); } @@ -652,6 +652,7 @@ $.fn.form.settings = { return (value != notValue); }, contains: function(value, text) { + text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); return (value.search(text) !== -1); }, is: function(value, text) {