Actually i have a search form in view and want to filter my list of data according to value provided by the search form.That’s why i need to get the value and set it as model attribute so that i can filter my select query in model with this attribute. I declared the attribute as safe in the current scenario.also write something like
$model->search_value = ‘some value’
array(‘search_value’, ‘safe’, ‘on’=>‘search’)
<div class="sidebar_search"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'search-form', 'enableAjaxValidation'=>false, 'action'=>Yii::app()->createUrl('Category/index'), )); ?> <?php echo $form->textField($model,'search_value',array('class'=>'search_input','onclick'=>'this.value=""')); ?> <input type="image" class="search_submit" src="<?php echo Yii::app()->request->baseUrl;?>/css/admin/images/search.png" /> <?php $this->endWidget(); ?> </div>
but it is showing error that "Property "Category.search_value" is not defined."
i know that there is some problem but can’t figure out what.i also don’t know even i can use it like that or not.But i need the following flow
1.get input value from view in controller action.
2.send this value to model so that i can use it to filter the result according to it.
please suggest what should i do when i am using AR.