I would like to create a form that allows the user to enter any number of values, each in a separate text field, using array notation. An example of the expected HTML output:
<dd id="dupa-element"> <input type="text" name="dupa[]" value=""> <input type="text" name="dupa[]" value=""> </dd>
However, I cannot find a way to introduce multiple input elements into one element using array notation without indexes.
I am currently doing this:
$elt1 = new Zend_Form_Element_Text('1'); $elt1->setOptions(array('belongsTo' => 'dupa')); $elt2 = new Zend_Form_Element_Textarea('2'); $elt2->setOptions(array('belongsTo' => 'dupa'));
While this works, Zend_Form treats them as independent elements (which can have different sets of validators and filters - this is cool), and the resulting HTML is something like that:
<dd id="dupa-1-element"> <input type="text" name="dupa[1]" id="dupa-1" value=""> </dd> <dd id="dupa-2-element"> <input type="text" name="dupa[2]" id="dupa-2" value=""> </dd>
Is there a (preferably simple) way to get the item nomenclature I am after?
source share