Hi Yii users
i am new to Yii and i would like to implement a user advanced search for a model. i inspired the code by the actionAdmin() method but i have two problems :
i would like to use POST not the GET method (i changed the code to use POST in the form action method and in
public function actionSearch()
{
$model=new Ad('search');
$model->unsetAttributes(); // clear any default values
if(isset($_POST['Ad'])){
$model->attributes=$_POST['Ad'];
}
$this->render('search',array(
'model'=>$model,
'dataProvider'=>$model->search(),
));
}
// in the search.php view
this $(’.search-form form’).submit(function(){
$.fn.yiiListView.update('classifieds-ad-list', {
type:'POST',
data: $(this).serialize()
});
return false;
});
and :
$this->widget(‘zii.widgets.CListView’, array(
'id'=>'classifieds-ad-list',
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
));
is this good??
in the ajax pagination when i go to next pages the search return all models in the database not only the searched models
??
please i need your help
thank you