Hello,
I'm currently using Zend_Form, and can't use square brackets in my
form elements' name. I've looked at the code, and it seems that the
method "setName" (by filterName) in Zend_Form_Element removes the
square brackets, why ? Moreover, there's an option in filterName to
allow square brackets.
Example :
require_once 'Zend/Form.php';
$f = new Zend_Form;
$e = $f->createElement('multiCheckbox', 'question[42]');
$e->setMultiOptions(array(
'Checkbox 1',
'Checkbox 2',
'Checkbox 3',
));
$f->addElement($e);
die($f)
I got input elements like this :
<input type="checkbox" value="0" name="cb42[]"/>
<input type="checkbox" value="1" name="cb42[]"/>
<input type="checkbox" value="2" name="cb42[]"/>
Instead of :
<input type="checkbox" value="0" name="cb[42][]"/>
<input type="checkbox" value="1" name="cb[42][]"/>
<input type="checkbox" value="2" name="cb[42][]"/>
How can I achieve this ?
--
Julien Huang