Model Not Valid Even With No [Required] Attribute
- by griegs
I have a model which is validating as False even though I have no validation rules attached to it what so ever.
So this is my model;
public class QuickQuote
{
public Enumerations.AUSTRALIA_STATES state { get; set; }
public Enumerations.FAMILY_TYPE familyType { get; set; }
public Enumerations.CoverLevel hospitalCover { get; set; }
public Enumerations.CoverLevel extrasCover { get; set; }
public Enumerations.YesNo pregnancy { get; set; }
}
And in my controller I have;
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(IndexFormViewModel fvm)
{
if (!ModelState.IsValid)
return View(fvm);
The problem is that unless I put a value into each field it's validating as false even though it shouldn't care.
Can anyone see what the problem is here?