Note that there are some explanatory texts on larger screens.

plurals
  1. POredirecting search result, form submit
    text
    copied!<p>in my index page I have this code to call search action:</p> <pre><code>$this-&gt;renderPartial('search'); </code></pre> <p>and this is the search action code:</p> <pre><code> $criteria = new CDbCriteria(); if (isset($_GET['city'])) { $q = $_GET['city']; $criteria-&gt;compare('fileName', $q, true, 'OR'); $criteria-&gt;compare('tags', $q, true, 'OR'); $dataProvider = new CActiveDataProvider("Files", array('criteria' =&gt; $criteria)); $this-&gt;redirect('result', array('dataProvider'=&gt;$dataProvider)); } $dataProvider = new CActiveDataProvider("Files", array('criteria' =&gt; $criteria)); $this-&gt;render('search'); </code></pre> <p>and this is the search view:</p> <pre><code> &lt;form method="get"&gt; &lt;?php $url = CHtml::normalizeUrl(array("files/search")); $model = Files::model(); $c = new FilesController('view'); $this-&gt;widget('zii.widgets.jui.CJuiAutoComplete',array( 'model'=&gt;$model, 'id'=&gt;'autocomplete', 'attribute'=&gt;$model-&gt;fileName, 'name'=&gt;'city', 'source'=&gt;$c-&gt;actionAutoComplete(), // additional javascript options for the autocomplete plugin 'options'=&gt;array( 'minLength'=&gt;'1', ), 'htmlOptions'=&gt;array( 'style'=&gt;'height:20px;', 'placeholder'=&gt;'search', 'value'=&gt;'isset($_GET["city"]) ? CHtml::encode($_GET["city"]) : "" ', ),)); ?&gt; &lt;input type="submit" value="search" /&gt; &lt;/form&gt; </code></pre> <p>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?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload