Skip to content

Instantly share code, notes, and snippets.

@andriesss
Created January 16, 2013 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andriesss/4547527 to your computer and use it in GitHub Desktop.
Save andriesss/4547527 to your computer and use it in GitHub Desktop.
<?php
/*
I would like to obtain the following elements:
<input type="text" name="foo[1]" />
<input type="text" name="bar[1]" />
*/
$element= new Zend_Form_Element_Text(1);
$element->setLabel('foo');
$element->setBelongsTo('foo');
$this->addElement($element);
$element= new Zend_Form_Element_Text(1);
$element->setLabel('bar');
$element->setBelongsTo('bar');
$this->addElement($element);
@andriesss
Copy link
Author

I've read @weierophinney 's response on http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Element-set-name-allowBrackets-td679084.html, but this doesn't seem to work with elements that have the same name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment