title: Require a field only if a checkbox is checked CakePHP 2 Validation
body: <p><strong>Heres the problem</strong></p>
  
  <p>I want to require a field (litters_per_year) only if another field that is a checkbox is checked. When I do this, cake is trying to force me to put a value into the field and I don't know why. I have tried setting required &amp; allowEmpty to false &amp; true respectively, but then my custom rule does not run.</p>
  
  <p><strong>Heres the code</strong></p>
  
  <p><em>NOTE</em>: The details of the following code aren't that important - they are here to provide a scenario.</p>
  
  <p>I have the following code in my <em>VIEW</em> which works fine:</p>
  
  <pre><code>echo $this-&gt;Form-&gt;input('litters_per_year', array(
      'label' =&gt; 'Litters per year (average)'
  ));
  </code></pre>
  
  <p>I have the following code in my <em>MODEL</em>'s public $validate:</p>
  
  <pre><code>'litters_per_year' =&gt; array(
      'isNeeded' =&gt; array(
          'rule' =&gt; array('isNeeded', 'litters_per_year'),
          'message' =&gt; 'Please enter the litters per year average'
      )
  )
  </code></pre>
  
  <p>which is calling the custom validation method</p>
  
  <pre><code>public function isNeeded($field) {
      // Check if a checkbox is checked right here
      // Assume it is not... return false
      return false;
  }
  </code></pre>
  
  <p>It returns false for simplicity to solve this issue.</p>
  
  <p>Let's assume that the checkbox field is named 'the_checkbox'.</p>