title: CakePHP: Return every possible result from search if certain search field is left blank
body: <p>I have a simple search engine in a CakePHP project. One of the searchable fields is set up like this (from my View):</p>
  
  <pre><code>echo $this-&gt;Form-&gt;input('field2', array('label' =&gt; 'FieldName', 'multiple' =&gt; true, 'div'=&gt;false, 'class' =&gt; 'chosen', 'options' =&gt; $fromController));
  </code></pre>
  
  <p>The user can select multiple entries from this dropdown, and the selections are returned. This works fine; however, I would like the search to return ALL records based on the value in field1 if field2 is left blank. Is there a way to do that? Here is the Controller code that returns the search results:</p>
  
  <pre><code>//Populate the dropdown    
  $fromController = $this-&gt;Model-&gt;find('list', array('fields' =&gt; array('field', 'field')));
  
  $requirements = array();
  $findOptions['conditions'] = array();
  
  $findOptions['conditions'] = array_merge($findOptions['conditions'], array('Model.field1' =&gt; $this-&gt;request-&gt;data['Model']['field1'],
          'Mode.field2' =&gt; $this-&gt;request-&gt;data['Model']['field2']));
  
  $specificresults = $this-&gt;Model-&gt;searchOptions($findOptions);
  $requirements = array_merge($specificresults); 
  </code></pre>
  
  <p>And the function from the Model:</p>
  
  <pre><code>function searchOptions($findOptions = array()) {
  $records = array();
  $findOptions['order'] = array('Model.field1'=&gt;'DESC');
  
  // return the final result....
  return $this-&gt;find('all', $findOptions);
  }
  </code></pre>
  
  <p>Right now, if field1 has a value, but field2 is left blank, nothing is returned. Just need to figure out how to tell the controller that I want everything.</p>