Hi.
As the title says, I’m trying to find out if there is a native way to find out which ruled caused the validation to return false. Some fields have two different rules attached and I need to know which is being broken so I can handle it.
Hi.
As the title says, I’m trying to find out if there is a native way to find out which ruled caused the validation to return false. Some fields have two different rules attached and I need to know which is being broken so I can handle it.
Currently, there is no way to obtain such info.
We can extend the onValidationError event, so it will contain the rule method as third parameter, will it help in your case? Or maybe you have some other suggestion, how current API can be improved?
Having the method as a third parameter does seem like the better way, since rules don’t seem to have any other sort of identifier.
Any other suggestions?
I agree that ability to react differently on different error messages, but I don’t see any good way to add it.
I’ve found a way around this, so it is no longer necessary in my particular case, although I think that it is a very useful feature for the future.
As for how to do it, maybe two types of .validate. With and without a callback. Without works just as it works now. With a callback, you can have .validade(function(validbool, rulesarray){ etc });. This would require the default rules to have some sort of id, though.