title: Revalidate form after post response
body: <p>The setup is as follows. </p>
  
  <ol>
  <li>All fields are filled out and form is valid.</li>
  <li>Submit is executed, BUT there are a server side check on the
  provided data, and it returns "error, duplicate found".</li>
  <li>A hidden (ng-hide is used here) input field is now shown and this
  field is set to required.</li>
  <li>Now the  <strong>problem</strong>  occurs. The submit button is still enabled, even though the form is invalid! </li>
  </ol>
  
  <p>Question is, how can I revalidate/update the validation state for the form after the serial number field is shown?
  I have tried with the following without any luck;</p>
  
  <pre><code>if (status == 413) {
      $scope.hide_serial_number = false;
      if ($scope.hide_serial_number == false) {
         document.getElementById("serial_no").required = true;
         $scope.myForm.serial_no.$invalid();
      };
  };
  </code></pre>
  
  <p>status code 413 = duplicate was found in DB.</p>
  
  <p>My submit button;</p>
  
  <pre><code>&lt;div class="form-actions"&gt;
      &lt;button type="submit" ng-disabled="myForm.$invalid" class="btn btn-primary btn-block btn-success btn-lg"&gt;Submit&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Please no jQuery answers, I'm doing all plain javascript – Thanks in advance!</p>