Take the 2-minute tour ×  I'm working with CakePHP v2.3.x and on
an edit page I need to dynamically update the page with search
results...  I'm making an AJAX call from one of my
Views/Tests/admin_edit.php view page to a specific action in my
QuestionsController.php.  Here's the action (so far) that
handles the request:  public function admin_search() {
$searchdata = $this->request->data;         $r =
$this->Question->find('all', array('conditions' =>
array('Question.id' => $searchdata['id'])));         echo
json_encode($r);   It currently only returns questions whose IDs
match the one entered by the user, but the finished version will
search several different fields. I know how to do this by adding
additional key/value pairs to the conditions array. However, I
don't know how to make those fields optional. What if the user
enters the question name, but NOT the id, or visa versa? Is
there a configuration so that CakePHP will ignore any empty
field conditions?  Similarly, is there a way to set the opera