Hi,
I'm trying to use CTabView, but having difficultly with it's implementation. Maybe I haven't grasped the concept so I thought I would ask for some help.
Here is my action before using CTabView. This basically loads up a search form.
public function actionSearch() { $search=new SearchForm; if(Yii::app()->request->isPostRequest) { // collect user input data if(isset($_POST['ASearchForm'])) $search->setAttributes($_POST['SearchForm']); // validate user input and redirect to previous page if valid if($search->validate()) { $this->redirect(array('list/list')); //send it to the list controller. } } $this->renderPartial('asearch',array('search'=>$search)); }
When trying to use CTabView, I changed the action towards the bottom as follows:
public function actionSearch() { $search=new SearchForm; if(Yii::app()->request->isPostRequest) { // collect user input data if(isset($_POST['ASearchForm'])) $search->setAttributes($_POST['SearchForm']); // validate user input and redirect to previous page if valid if($search->validate()) { $this->redirect(array('list/list')); //send it to the list controller. } } $this->widget('CTabView',array('tabs'=>array( 'tab1'=>array('title'=>'Search','view'=>'search',array('search'=>$search)), 'tab2'=>array('title'=>'Advanced Search'), 'tab3'=>array('title'=>'Listing ID Search'), 'tab4'=>array('title'=>'Address Search')))); }
I basically added the code for the CTabView. Within tab1, i'm trying to create the search view as used in the bottom of the code example 1. It's not recognizing the php variables I'm trying to send via array('search'=>$search), giving an undefined variable error for search.
Any help would be appreciated.
R