Alright, so I have a model that looks like:
public class CustomerViewModel {
public string Password { get; set; }
}
public class CustomerAddViewModel {
public CustomerViewModel Customer { get; set; }
[System.ComponentModel.DataAnnotations.Compare("Customer.Password", ErrorMessage = "The confirm password should match")]
public string ConfirmPassword { get; set; }
}
I get the error message "Could not find a property named Customer.Password" on validation.
I found this SO Question, but it doesn't apply because in the latest version of validation.unobtrusive, the code looks like this:
element = $(options.form).find(":input[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
where the escapeAttributeValue handles all the valid special characters.
I've tried using System.Web.Mvc.Compare instead, but that causes an error while rendering the view.
Any ideas?