app/assets/javascripts/semantic-ui/modules/behavior/form.js in semantic-ui-rails-0.8.2 vs app/assets/javascripts/semantic-ui/modules/behavior/form.js in semantic-ui-rails-0.8.3
- old
+ new
@@ -358,21 +358,21 @@
// takes validation rule and returns whether field passes rule
rule: function(field, validation) {
var
$field = module.get.field(field.identifier),
type = validation.type,
- value = $field.val(),
+ value = $field.val() + '',
bracketRegExp = /\[(.*?)\]/i,
bracket = bracketRegExp.exec(type),
isValid = true,
ancillary,
functionType
;
// 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);
}
// normal notation
else {
@@ -650,9 +650,10 @@
},
not: function(value, notValue) {
return (value != notValue);
},
contains: function(value, text) {
+ text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
return (value.search(text) !== -1);
},
is: function(value, text) {
return (value == text);
},