Matthew Weier O'Phinney-3 wrote:
>
>> Matthew Weier O'Phinney-3 wrote:
>> >
>> > Yes. Create an element for each child, and attach each with a different
>> > form element name:
>> >
>> > foreach ($children as $key => $child) {
>> > $form->addElement('text', 'child' . $key, array('value' =>
>> > $child'));
>> > }
>> >
>> >
>
So since all of my elements are being created in the init() method and that
seems to run even before the __construct , how to I get the value to
$children ?
If i call $renderform = new TestForm() from my Controller, the form is
already built by the time I try to set the $children by
$renderform->children = array('aaa', 'bbb', 'ccc');
I have been following the tutorials at:
http://blog.astrumfutura.com/archives/360-Example-Zend-Framework-Blog-Application-Tutorial-Part-6-Introduction-to-Zend_Form-and-Authentication-with-Zend_Auth.html
Is this still the recommended way to create a form with my needs?
--
View this message in context:
http://www.nabble.com/Zend_Form-%3A-Subforms%2C-dynamic-element-creation-and-best-practices-tp18203896p18263554.html
Sent from the Zend Framework mailing list archive at Nabble.com.