views:

37

answers:

2

is there way to create a rule in the jquery validiation plugin that allows you to say not contains "value"?

A: 
doesnotContain: function(value, element, param) {
 return this.optional(element) || (value.indexOf(param)>0)?true:false;
},

Something like that?

Gausie
+1  A: 

you can add method

jQuery.validator.addMethod("notcontainfoo", function(value, element) { 
  return value != 'foo'; 
}, "You can't fill this with 'foo' !! ");
Anwar Chandra