title: MVC3 Only posted form values retained?
body: <p>I am using strongly typed views in an MVC3 web app.  I've noticed that when a form is submitted, the ViewModel that is passed to the controller only has values for properties that have form elements associated with them.  For instance, the example below shows a simple confirmation View with a checkbox and a phone number that the user must confirm before proceeding.  When the form is submitted to the controller action, the UserConfirmed property contains a value, but the PhoneNumber property is null.  </p>
  
  <p>Is there any way for the ViewModel to retain all of its values or do I have to repopulate the ViewModel properties that do not have form elements associated with them?</p>
  
  <p>The View</p>
  
  <pre><code>@model WebMeterReplacement.ViewModels.Appointment.ScheduleConfirmationViewModel
  @using (Html.BeginForm()) {
  @Html.ValidationSummary(false)
  
  @Html.CheckBoxFor(model =&gt; model.UserConfirmed) 
  &lt;span&gt;Please confirm before proceeding&lt;/span&gt;
  &lt;div&gt;
      Phone Number: @Model.PhoneNumber
  &lt;/div&gt;
  &lt;input type="submit" value="Confirm"/&gt;
  </code></pre>
  
  <p>The Controller</p>
  
  <pre><code>[HttpPost]
  public ActionResult ScheduleConfirmation(ScheduleConfirmationViewModel model)
  {
  if (model.UserConfirmed)
  {
      // add ViewModel data to repository
  }
  else
  {
      ModelState.AddModelError("ERROR", WebResources.strERROR_ConfirmSchedule);
  }
  
  return View(model);
  }
  </code></pre>