I am using Yii 1.1.15 framework.
I can't search & as a symbol in a attribute (ex. brand_name) in the query string. If I enter & symbol the URL looks like this:
localhost/doctors/brand/?brand[brand_name]=&&brand[brand_status]=
Here the case is brand[brand_name]=&
. It does not consider the &
and is taken as the next parameter termination, if i just encode that character, it becomes: %26
so the url becomes localhost/doctors/brand/?brand[brand_name]=%26&brand[brand_status]=
and it gives the correct result.
But how to encode the yii CGridView filter text data?
Thanks in advance.
CGridView
uses GET as the default ajax type and &
is the delimiter for http request's GET parameters, so you can't use this character as part of your search string. I think the solution is using POST instead of GET for ajax requests. For changing CGridView ajax parameter from GET to POST, add 'ajaxType' => "POST"
to your cgridview options:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'...',
'ajaxType' => "POST",
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
...
),
)); ?>