This is whats in my model:
public CheckBoxListItem Same { get; set; }
[Required(ErrorMessage = "* Billing Name field is required")]
public string BillingName { get; set; }
This is what is in my view:
@Html.LabelFor(model => model.Same.IsChecked, "Billing Is Same As Shipping")
@Html.HiddenFor(model => model.Same.Text)
@Html.CheckBoxFor(model => model.Same.IsChecked)
</div>
<h3>Billing Information</h3>
<div>
@Html.LabelFor(model => model.BillingName, "Name")
@Html.EditorFor(model => model.BillingName)
@Html.ValidationMessageFor(model => model.BillingName)
</div>
When the checkbox is checked, I want the required validation for BillingName to no longer be required when the form is submitted. How do I go about doing this in MVC?