2

I want to create a form similar to the form given below using Zend framework

<input type="text" name="number[]" /> 

I tried with the following code

$element1 = new Zend_Form_Element_Text('element', array('isArray' => true));
        $element1->setName('element');
        $element2 = new Zend_Form_Element_Text('element', array('isArray' => true));
        $element2->setName('element');

But i came across a problem as i could only get the latest value of the array. I want to get full array in the textfield name 'number'.

Could you please help me on this issue. Thanks.

Gordon
  • 312,688
  • 75
  • 539
  • 559
user505755
  • 21
  • 2
  • possible duplicate of [Using array notations for form elements names in Zend_Form](http://stackoverflow.com/questions/4164453/using-array-notations-for-form-elements-names-in-zend-form) – Gordon Nov 12 '10 at 13:13
  • possible duplicate of [How to configure Zend Form to use Array Notation](http://stackoverflow.com/questions/1928551/how-do-configure-zend-form-to-use-array-notation) – Gordon Nov 12 '10 at 13:14
  • Seems like there is no way to do that unless the name of the input change for something like: number[first] or number[0]. Only multicheckbox allow empty indexes. Am I right @Gordon ? – Keyne Viana Nov 12 '10 at 15:27
  • @Keyne afaik that is correct. [The ZForm architecture does not allow for empty element names](http://framework.zend.com/issues/browse/ZF-3782). [There seems a user-supplied patch for this, which I've neder used and cannot tell anything about it](http://framework.zend.com/issues/browse/ZF-9516) – Gordon Nov 12 '10 at 16:08

0 Answers0