Mar 22, 2011 03:25 PM|bradwils|LINK
The reason you're not emitting any client-side validation is because you're never rendering an edit box with the correct name to line up with your validation rule.
Your validaton rule is hooked up to "MySubModel.DateOfBirth". You're rendering edit boxes for "MySubModel.DateOfBirth.Day", "MySubModel.DateOfBirth.Month", and "MySubModel.DateOfBirth.Year". None of those things has an associated validation rule attached
to it, so none of them gets any unobtrusive validation attributes.
For illustration purposes, inside of your template, put a call to Html.TextBox(String.Empty) and you should see an extra text box that now has all of the client rules attached to it.
What you're doing, with the 3 separate editor boxes, isn't strictly compatible with the validation system (in the way you were hoping, anyway). You're kind of on your own here. I'm not really sure what you're trying to achieve, so I'm not really sure what
to tell you to do.