Dan G. Switzer, II schrieb:
Jörn,

You can do that already. After implementing the suppurt for expressions,
support for plain functions was really easy. I can imagine adding a
method on the fly:

rules: {
        field2: function() { return condition; }
}

I wasn't aware of that. However, if you changed that do:

rules: {
        field2: {custom: function() { return condition; }}
}

Then you could do:

messages: {
        field2: {custom: "My custom function error!"}
}

Also, just so I'm clear on how it works, what happens with the following:

rules: {
        field2: function() { return false; }
}

Does this just throw the field2 is required? What happens if I want to apply
other validation rules to field2?
Sorry, my example was a bit misleading. So far you can't pass a function as a rule, only as a value to required.
supported: field: { required: function() {} }
not supported: field: function() {}

By adding support for the latter, you could do almost everything, but I'm not yet sure how it should actually work.

--
Jörn Zaefferer

http://bassistance.de

Reply via email to