title: Perform validation on hidden fields
body: <p>I have the view below:</p>
  
  <pre><code>    @Html.LabelFor(m =&gt; m.CompanyPostCode)
      @Html.TextBoxFor(m =&gt; m.CompanyPostCode)
  
      @Html.LabelFor(m =&gt; m.CompanyCity)
      @Html.TextBoxFor(m =&gt; m.CompanyCity)
  
      @Html.HiddenFor(m =&gt; m.CompanyCityID)
  </code></pre>
  
  <p>All attributes are marked as <strong>[Required]</strong> in my view model. Then problem is that my CompanyCityID (marked as Required) is hidden and thus no validation is done in the view. If I show this attribute in my view the validation is done. </p>
  
  <p><img src="https://i.stack.imgur.com/8DerG.png" alt="enter image description here"></p>
  
  <p>My question: is it possible to perform a validation on a hidden field? A workaround exist?</p>
  
  <p>It may seems a little strange to validate a hidden field. The reason is that this field is filled from jQuery based on special rules. If it is not filled, I know something is not valid on the view.</p>
  
  <p>Thanks.</p>