title: MVC Form values not reset
body: <p>I have an issue where the hidden values in a form are not updating when the new ActionResult is returned.</p>
  
  <p>For example, a user will check several records and click the Update Completion button.  This makes an Ajax called to the UpdateCompleted action that sets a date for the checked records and once the Ajax call returns the form is submitted.  After performing some logic in the form submit Action method, an updated model is returned with the IsChecked value set to false for all records in the model, but the form is retaining the previous checked value due to the generated id below having the same value.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>    &lt;td&gt;
          @Html.CheckBoxFor(model =&gt; Model.WorkOrderDetails[x].IsChecked)
          @Html.HiddenFor(modelItem =&gt; Model.WorkOrderDetails[x].IsChecked)
          @Html.HiddenFor(modelItem =&gt; Model.WorkOrderDetails[x].WorkOrderEntityId)
          @Html.HiddenFor(model =&gt; model.WorkOrderDetails[x].WorkOrderId)
      &lt;/td&gt;
  </code></pre>
  
  <p><strong>Rendered HTML</strong></p>
  
  <pre><code>    &lt;td&gt;
          &lt;input data-val="true" data-val-required="The IsChecked field is required." id="WorkOrderDetails_0__IsChecked" name="WorkOrderDetails[0].IsChecked" type="checkbox" value="true"&gt;&lt;input name="WorkOrderDetails[0].IsChecked" type="hidden" value="false"&gt;
          &lt;input id="WorkOrderDetails_0__IsChecked" name="WorkOrderDetails[0].IsChecked" type="hidden" value="False"&gt;
          &lt;input id="WorkOrderDetails_0__WorkOrderEntityId" name="WorkOrderDetails[0].WorkOrderEntityId" type="hidden" value="ODU="&gt;
          &lt;input id="WorkOrderDetails_0__WorkOrderId" name="WorkOrderDetails[0].WorkOrderId" type="hidden" value="NjQ4OTU3"&gt;
      &lt;/td&gt;
  </code></pre>
  
  <p><strong>Submit Code</strong></p>
  
  <pre><code>@using(@Html.BeginForm("Index", "WorkOrderMaster", FormMethod.Post, new { id = "workOrderMasterForm" }))
  {
  &lt;div&gt;
  &lt;div class="project-buttons"&gt;
      &lt;div class="btn-group"&gt;
          &lt;input id="submitCompletion" class="btn btn-success" value="Update Completion" data-submit-url='@Url.Action("UpdateCompleted", "WorkOrderMaster")' /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  $(function () {
      $('#submitCompletion').click(function () {
          $.ajax({
              type: 'POST',
              url: $(this).data('submit-url'),
              data: $('#workOrderMasterForm').serialize(),
              success: function (data) {
                  $('#workOrderMasterForm').submit();
              }
          });
      });
  });
  </code></pre>
  
  <p>I would expect the new values from the model to be used but this is not occurring.</p>
  
  <p>Is it recommended to code the input values manually in this situation in order to avoid the following format?</p>
  
  <blockquote>
    <p>ClassName_Index_PropertyName</p>
  </blockquote>
  
  <p>Thanks in advance for the time you took to look at this question.</p>