Hi.

i'm trying to use zend_form and subform to construct a user input form that
allows the user to add new rows.

what i've started out with is this:

form creation (details left out)

$numbers = new Zend_Form_SubForm();
$numbers->setIsArray(true);
$numbers->addElement('text', '1', array(
    'label' => 'Number 1',
    'required' => true,
));
$numbers->addElement('text', '2', array(
    'label' => 'Number 2',
    'required' => true,
));
$form->addSubForm($numbers, 'numbers');


which basically transforms to this:

<input type="text" name="numbers[1]" id="numbers-1" value="6" />
<input type="text" name="numbers[2]" id="numbers-3" value="4" />


when i submit the form the values 4 and 6 are returned to my action as
expected.

but if the user adds another row giving this:

<input type="text" name="numbers[1]" id="numbers-1" value="6" />
<input type="text" name="numbers[2]" id="numbers-3" value="4" />
<input type="text" name="numbers[3]" id="numbers-2" value="5" />


i still see only 2 values 6 and 4.

i know for sure that all three values are posted to my action because doing
this:

  foreach ($_POST['numbers'] as $row) {
               echo $row;
}

gives 6 4 and 5.

but how come zend doesn't see this extra value?

is it possible at all to use zend_form for this kind of tricks?

thanx in advance.

kim

-- 
View this message in context: 
http://old.nabble.com/adding-elemets-to-zend_form-dynamically-tp26157848p26157848.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to