Value of this field should be empty or valid email address. But EmailValidator is always execute and I also get error for empty values. How can I set binder to allow empty values? Thank you.
Regards,
Matic
Hi Matic,
please notice that EmailValidator is very simple class extending RegexpValidator. What I suggest is to create your own class i.e. EmptyOrEmailValidator extending RegexpValidator. The only difference between your class and the original EmailValidator should be the Regex pattern that you define. So instead of:
Thank you for solution. My implementation was by using custom validation method. But I think it should exist some standard Binder solution for this problem. For example - if you mark Field as required = false, then it is not needed that validator is even call.