Yii Framework Forum: Parent / Child Class In One Form - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Parent / Child Class In One Form Rate Topic: -----

#1 User is offline   coy_coy 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 10-October 12

Posted 30 January 2013 - 12:36 PM

I am having problem figuring out if this is possible in yii.

In my form i combined two models (parent and child) to create and update.

A parent class can have at least 1 child to maximum of 6 children. I created a number of fields in every instance of the child. I am thinking of creating an array of text fields in every attribute of the child, is that possible?

<?php echo $form->textField($childModel,'item_description[0]',array('size'=>68,'maxlength'=>100)); ?>
<?php echo $form->textField($childModel,'item_description[1]',array('size'=>68,'maxlength'=>100)); ?>
<?php echo $form->textField($childModel,'item_description[2]',array('size'=>68,'maxlength'=>100)); ?>
.
.
.


In my controller, will for each loop work in traversing those arrays?
Thanks.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users