in my index page I have this code to call search action:
$this->renderPartial('search');
and this is the search action code:
$criteria = new CDbCriteria();
if (isset($_GET['city'])) {
$q = $_GET['city'];
$criteria->compare('fileName', $q, true, 'OR');
$criteria->compare('tags', $q, true, 'OR');
$dataProvider = new CActiveDataProvider("Files", array('criteria' => $criteria));
$this->redirect('result', array('dataProvider'=>$dataProvider));
}
$dataProvider = new CActiveDataProvider("Files", array('criteria' => $criteria));
$this->render('search');
and this is the search view:
<form method="get">
<?php
$url = CHtml::normalizeUrl(array("files/search"));
$model = Files::model();
$c = new FilesController('view');
$this->widget('zii.widgets.jui.CJuiAutoComplete',array(
'model'=>$model,
'id'=>'autocomplete',
'attribute'=>$model->fileName,
'name'=>'city',
'source'=>$c->actionAutoComplete(),
// additional javascript options for the autocomplete plugin
'options'=>array(
'minLength'=>'1',
),
'htmlOptions'=>array(
'style'=>'height:20px;',
'placeholder'=>'search',
'value'=>'isset($_GET["city"]) ? CHtml::encode($_GET["city"]) : "" ',
),));
?>
<input type="submit" value="search" />
</form>
I want to show the search results in another view, so once clicked the search submit button I want to redirect to another view to show the results, but in this code the search result is shown in the index page. so how to do it?