Saving data from one form into 2 models 2nd model fails

I’ve created a form with fields from two diferent models and followed the instructions in the wiki. everything appears to be fine with the exception of the second model data is never saved. The original view files were created using gii. Can someone point me in hte right direction?



public function actionCreate()


	$model=new AutoTestScript;

	$meta=new AutoTestScriptMeta;

	// Uncomment the following line if AJAX validation is needed

	// $this->performAjaxValidation($model);

     if (isset($_POST['AutoTestScript']) && isset($_POST['AutoTestScriptMeta'])) 







		$this->redirect(array('admin','id'=>$model->id, $meta->id));








create.php snippit at end


<font size=2><b>Add Automated Test Script</b></font>



<?php echo $this->renderPartial(’_form’, array(‘model’=>$model, ‘meta’=>$meta )); ?>

Submit button from _form.php<tr>


<td><?php echo CHtml::submitButton($model->isNewRecord ? ‘Create’ : ‘Save’); ?></td>

It may be necessary to do some debugging here (to check if saving process is successful or not). You can try to use something like:


  echo 'Something';

And there is getErrors() method to get error messages (if any).

thanks for the reply. I figure out that I was missing code to grab the value of the FK in model1 into a field in model2.