validation - How to match a value to a string within "rules" using jquery validate.js (bassistance.de) -
i want check if form radio input value matches string exactly, "equalto" match string , not field input can't find if there simple way similar using "equalto".
as below want form field "foo" value match "bar" , hoping replace ????????s simple command if possible?
if not appreciate showing how can implement string match within "rules" method.
$("#this_form").validate({ rules:{ name:{ required:true }, foo:{ ????????: "bar", required:true } }
});
so here want form validate if value of foo "bar" , not if value "manchu".
< input type="radio" name="foo" value="bar" />
< input type="radio" name="foo" value="manchu" />
(i think reason pretty obvious, answer foo needs bar otherwise not want form submit.)
you can this:
jquery.validator.addmethod("myfunc", function(val) { if(val=='mystring'){ return true; } return false; }, "values not match.");
you can use method 'myfunc' use built in email function.
... foo:{ myfunc:true
Comments
Post a Comment