title: How can I make a field required only under certain conditions?
body: <p>I have an Edit view that I use for creating and editing Users. The view has <code>Password1</code> and <code>Password2</code> fields, for password and confirmation respectively. These are not marked as required in the view model, as when editing a user, these fields are optional, only used to change a password.</p>
  
  <p>I would not like to have two almost exactly the same view models, differing only by two <code>Required</code> attributes. I do have server validation for these fields, but I have a real dislike for the two-phase validation, where a user fixes all client validation errors, only to submit and wait, and then be presented with server validation errors.</p>
  
  <p>Is there some way I can switch client validation on for these fields in certain cases? I know I can use jQuery to add the necessary attributes, but I was hoping for a simpler and cleaner solution.</p>