title: Why does grails add a hidden checkbox to a form - and what does it do with it?
body: <p>I have a checkbox on my GSP page as follows (which was stolen directly from the scaffolded "create" code for my domain object)...</p>
  
  <pre><code>&lt;tr class="prop"&gt;
  &lt;td valign="top" class="name"&gt;
    &lt;label for="isSelling"&gt;&lt;g:message code="person.isSelling.label" default="Is Selling" /&gt;&lt;/label&gt;
  &lt;/td&gt;
  &lt;td valign="top" class="value ${hasErrors(bean: personInstance, field: 'isSelling', 'errors')}"&gt;
      &lt;g:checkBox name="isSelling" value="${personInstance?.isSelling}" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>This works just fine, except when I look at the elements in the resulting form I have a hidden checkbox alongside the real one...</p>
  
  <pre><code>&lt;tr class="prop"&gt;
  &lt;td valign="top" class="name"&gt;
    &lt;label for="isSelling"&gt;Is Selling&lt;/label&gt;
  &lt;/td&gt;
  &lt;td valign="top" class="value "&gt;
      &lt;input type="hidden" name="_isSelling" /&gt;
      &lt;input type="checkbox" name="isSelling" id="isSelling"  /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li>why is it there?</li>
  <li>what does Grails do with it?</li>
  <li>if I am looking at the form values in Javascript, which input value should I take?</li>
  </ol>
  
  <p>Just inspecting what happens when the checkbox gets set on and off in my page, it appears that the hidden one is ignored, so I am imagining there is some cunning processing going on when the submit action occurs which looks at the _isSelling and isSelling for some magical purpose. Anyone have any insight into what Grails is doing?</p>
  
  <p>Thanks</p>