Jun 4, 2009 at 1:17 AM
Edited Jun 4, 2009 at 1:31 AM
I'm new to xVal and trying to get it running in my project. So far so good but I am running into a small issue.
In my registration page I have 3 fields: email, password, confirmPassword
Here is my validation check (or part of it):
if(user.Password != confirmPassword)
throw new RulesException("confirmPassword", "Password does not match", user);
var errors = ValidationRunner.GetErrors(user, "Email,Password", null);
if(errors.Any()) throw new RulesException(errors);
Obviously RulesException gets thrown to my controller code:
user = _accountService.CreateNewUser(email, password, confirmPassword);
When my view prints Html.ValidationMessage("confirmPassword") it comes up empty... But
Html.ValidationSummary displays my error and message correctly.
When viewing my ModelState I notice that I have one key "confirmPassword" and a second key ".confirmPassword" - the second key contains the error.
What am I doing wrong?
Edit** I also wanted to mention that confirmPassword is not a part of my model object - I don't know if that has anything to do with it.