Open RCMax opened 8 years ago
@RCMax Are you after some like this? http://jsfiddle.net/40s6w103/
I don't think so.
I want to create a reusable custom validation rule. The message logic shouldn't have to be specified/re-specified every time someone uses this custom validation rule. I would like this logic to be the responsibility of the custom validation rule, not the caller.
I thought you're familiar with anonymous rules so I've defined it like that. Here's the updated example http://jsfiddle.net/40s6w103/2/
Will that help in your case? Thanks
As I see it, you currently can compute a validation message based on parameters, by using the template system.
The problem I have is that you cannot do the same based on the value of the field.
Let say you have a select field that supports tagging and you want apply validation to each value. It would be nice to able to include the invalid values in the validation message.
select field : values States : New York, Maine, Quebec, Montreal
Ex. Some values are invalid: Quebec, Montreal
This example is not the best since I would suggest states instead of allowing tagging, but the need is still there.
Actually, you can do this with async validation rules since you can return an object. like this :
Is it possible to do the same with normal (not async) validation?