markux
(Marco Patania)
1
Hello everybody,
in SiteController index action I’ve this code:
public function actionIndex()
{
$result = null;
if(isset($_GET['q'])) {
$result = app()->mycomp->findObjects(array('terms'=>$_GET['q'], 'title'=>'true'));
}
$this->render('index', array('result'=>$result));
}
In index.php I’ve a simple form with 1 input text to submit query string.
If I submit twice I’ve this url
/index.php/site/index?q=home&q=bar
How to remove clear params on new submit?
thanks
jayrulez
(Waprave)
3
Specify the action in your form.
If you are using CHtml::… do this
echo
CHtml::beginForm(array('/controller/action'));
or
<form action="<?php echo Yii::app()->createUrl('/controller/action'); ?>" method="get">
if you are using html markup
markux
(Marco Patania)
4
thanks. With widget I added action param:
<?php $form=$this->beginWidget(‘CActiveForm’, array(
'id'=>'search-form',
'enableAjaxValidation'=>false,
'method'=>'get',
'action'=>'index'
));
?>