AI OnAI Off
you can just use EmailAddress attribute instead. In my side, I use both Required and EmailAddress attribute on one property, it works just good. such as the following :
[Required(ErrorMessage = "Email is required")]
[EmailAddress(ErrorMessage = "Email is not valid")]
public virtual string Email { get; set; }
Hi all,
I have a problem with the use of attributes (both standard and with custom).
PROBLEM:
I want to use to validate the input text email address (you can do this:
1) [DataType (DataType.EmailAddress)];
2) [RegularExpression (@ "^ ([A-Za-z0-9._% + -] + @ [A-Za-z0-9. -] + \. [A-Za-z] {2,9}) $ ", ErrorMessage =" Must be valid email address ")];
3) create custom attribute [EmailAddress])
If I use another attribute to the field [Requered] then before creating a page (block) episerver offers to fill in all the fields that are marked as [Requered]. And at this point, he ignores all attributes except described in second solution [RegularExpression()].
How to make in this window are used all the attributes?
Hope for your help