i want to have a single form to collect data for two models. I already viewed the documentation ‘How to use a single form to collect data for two or more models?’. I have incoperated it in my code but its not working.
The following is my controller code
public function actionCreate()
// Uncomment the following line if AJAX validation is needed
$model2->bus_product_id = $model->bus_type_id;
I also made the changes in _form i.e echo $form->errorSummary(array($model,$model2)); and the changes in create i.e $this->renderPartial(’_form’, array(‘model’=>$model,‘model2’=>$model2));.
But the code is still not working. Do i need to make changes anywhere else?
I have another issue related to the same. I want to make some inserts in model2. Currently i am able to isert the FK. How do i insert other data? Am i supposedd to use aftersave() for the same? If so can u please tell me how to go about that? Thanks