Hi everyone, I would like to see an example of the EmailValidator class.
Can you help me, please? :slight_smile:

from [url=]


tf = new TextField( "A field, must contain an e-mail address or be empty");
     tf.addValidator(new EmailValidator("Invalid e-mail address {0}"));


If you call tf.validate() you’ll get an InvalidValueException if the mail address in not valid, otherwise nothing will happen.


Ok!, thanks Guglielmo.

Just for the completeness: If you use JSR 303 validation with hibernate’s implementation, you can annotate your email property with org.hibernate.validator.constraints.Email