Best Way To Do A Search

hi

What is the best way to do a search based in a form submit.

I have this form:


 <?php

    $form = $this->beginWidget('CActiveForm', array(

        'id' => 'search-quick',

        'enableClientValidation' => true,

        'clientOptions' => array('validateOnSubmit' => true),

            ));

?>

<div class="row">

    <?php

    echo CHtml::dropDownList('pessoas', '', CHtml::listData(Casa::model()->findAll(), 'pessoas', 'pessoas'), array(

        'prompt' => 'Select Pessoas',

        'ajax' => array(

            'type' => 'POST',

            'url' => CController::createUrl('casa/dynamicTipo'),

            'update' => '#tipo', //selector to update


            )));

    ?>

</div>

    <div class="row">

        <?php

    echo CHtml::dropDownList('tipo', '', CHtml::listData(Casa::model()->findAll(), 'tipo', 'tipo'), array(

        'prompt' => 'Select Tipo',

        'ajax' => array(

            'type' => 'POST',

            'url' => CController::createUrl('Casa/dynamicLocalidade'),

            'update' => '#localidade',

            'data' => array('tipo' => 'js:this.value'),

            )));

 ?>

</div>

    <div class="row">

        <?php

    echo CHtml::dropDownList('localidade', '', CHtml::listData(Casa::model()->findAll(), 'localidade', 'localidade'), array(

        'prompt' => 'Select Localidade'));

     ?>

</div>

    <?php echo CHtml::textField('inicio','',array('class'=>'datepick')) ?>

    <?php echo CHtml::textField('fim','',array('class'=>'datepick')) ?>

    <div class="row buttons">

        <?php echo CHtml::submitButton('Go', array('id' => 'btreserv', 'class' => 'but')); ?>

    </div>

    <?php $this->endWidget(); ?>

The model to be searched exists as the controller. Theres a method or/and action that gii generates that i can use or i have to do a new one ?

Use gii-generated search() function as a skeleton or a template.

You can see the excellent sample code that makes use of search() function in gii-generated "admin" page.

The following wiki article explains it in details.

http://www.yiiframework.com/wiki/381/cgridview-clistview-and-cactivedataprovider/