Hello, I need help with understanding renderPartial. I have 2 tables:
When I create Payment I set amount and date, then I send values to Yearly and divide amount etc etc…
When I update Payment I want to get form from Yearly update. Now I have:
But I don’t know how to get proper values in my form. Yearly update form should be:
I don’t know how should I get values from right model etc …
<?php echo $this->renderPartial('_form', array('model'=>$model));
echo $this->renderPartial('//yearly/_form4up',array('model'=>new Yearly));
Seems that you are creating a new model for Yearly try as
In other words, you are not using saved data but creating a new instance of Yearly model.
Yup it works. Now I’m not sure how I can do some stuff like:
I have now in 1 form two save buttons. Can I do something about it ??
If I want to set new value for my yearly in 1 form with payment, I should send it from Payment controller ?
What I think is that you are trying to save relative or related model values.
Payment is main model and Yearly is a related or child model having related records about payment.
So, in your controller, you need to do it as
Same with editing/updating records.
I’m not sure what i am doing wrong but I get ‘Undefined index: Yearly’ error when I try to save value in Payment.
You need to debug first what your Yearly form posts i.e. How this form fields are managed in html.
try to do
and check the index of Yearly data