I am using .NET 4 with MVC 2 for validating with Annotations. Is there a (simple) solution for giving back a warning instead of the error?
All validation Attributes have ErrorMessage property. You can give your custom error message
public class Product
{
[StringLength(50)]
[Required(ErrorMessage = "Your user friendly message")]
public string Name { get; set; }
}
Then change the CSS styles of the error messages.
/* Styles for validation helpers
-----------------------------------------------------------*/
.field-validation-error
{
color: #ff0000;/*change the color*/
}
/*Other validation related styles*/