PDA

View Full Version : [CLOSED] EmailValidation attribute



jpadgett
Feb 13, 2013, 8:09 PM
I have the following in one of my models:


[Required]
[EmailValidation(Message = "Please enter a valid email.")]
[Display(Name = "Email")]
public string Email { get; set; }

In my view, I have:


Html.X().TextFieldFor(m => m.Email),


It works - except that the "Please enter a valid email" validation message shows while I'm actually typing in the email. As soon as I type in the first letter, it appears. Is there any way to suppress it until the blur event?

Baidaly
Feb 14, 2013, 2:08 AM
Hello!

Try to set False in ValidateOnChange

jpadgett
Feb 14, 2013, 4:38 PM
Perfect. Thanks!