CTabview with Form

hi,

At my tab, have 5 form. i have a problem when insert data at my form. I attached an image what i’m try doing.

The problem is, when i click ‘save’ button, no data insert to my database.


 $userList=Bangunan::model()->findAll(); // <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' /> should this be moved into the site controller???

           $viewData = array

               (

                  'userList'=>$userList

               );


     




         $Tabs     = array

               (

                 

                  'tab1'=>array('title'=>'Bangunan','view'=>'/bangunan/_form','data'=>array('model'=>Bangunan::model())),

                  'tab2'=>array('title'=>'Pelan','view'=>'/pelan/_form','data'=>array('model'=>Pelan::model())),

                  'tab3'=>array('title'=>'Bilik','view'=>'/bilik/_form','data'=>array('model'=>Bilik::model())),

                  'tab4'=>array('title'=>'Rak','view'=>'/rak/_form','data'=>array('model'=>Rak::model())),

                  'tab5'=>array('title'=>'Para','view'=>'/para/_form','data'=>array('model'=>Para::model())),

               );




         $this->widget('CTabView', array('tabs'=>$Tabs, 'viewData'=>$viewData, ));


        ?>



Hope anyone can help me. Thank you.

any idea?

Post the code for the view for the form plse.

/bangunan/_form.php


<div class="form">


<?php $form=$this->beginWidget('CActiveForm', array(

	'id'=>'bangunan-form',

	'enableAjaxValidation'=>false,

)); ?>


	<p class="note">Fields with <span class="required">*</span> are required.</p>


	<?php echo $form->errorSummary($model); ?>


	<div class="row">

		<?php echo $form->labelEx($model,'nama_bangunan'); ?>

		<?php echo $form->textField($model,'nama_bangunan',array('size'=>45,'maxlength'=>45)); ?>

		<?php echo $form->error($model,'nama_bangunan'); ?>

	</div>


	<div class="row">

		<?php echo $form->labelEx($model,'keterangan'); ?>

		<?php echo $form->textField($model,'keterangan',array('size'=>60,'maxlength'=>255)); ?>

		<?php echo $form->error($model,'keterangan'); ?>

	</div>


        


	<div class="row buttons">

		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>

	</div>


<?php $this->endWidget(); ?>


</div><!-- form -->

The post data should arrive (try (print_r($_POST))), you have some error in the managing of this data.

Check in the controller if the $model->save succeed, if not try print_r($model->errors) to understand why


public function actionIndex()

	{

            $bangunan=new Bangunan;

            $pelan=new Pelan;

            if(isset($_POST['Bangunan']))

		{

			$bangunan->attributes=$_POST['Bangunan'];

                         // print_r($model);

			if($bangunan->save())

				$this->redirect(array('index','id'=>$bangunan->id));

		}

                else

                     if(isset($_POST['Pelan']))

		{

			$pelan->attributes=$_POST['Pelan'];

                          $pelan->image=CUploadedFile::getInstance($pelan,'image');//upload file

			if($pelan->save())

                                $pelan ->image->saveAs('images/'.$pelan->image);

                                $image = Yii::app()->image->load('images/'.$pelan->image);

                                $image ->resize(200,200);

                                $image ->save('images/'.$pelan->image);

				$this->redirect(array('index','id'=>$pelan->id));

		}

		$this->render('index');

              

       

	}



to create a form and save to database, it works!

But my coding is very messy and maybe have better way.