Julien Huang wrote:
> 
> 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
> 
> 

Just extend Zend_Form_Element and change that part where it's removing
brackets. Here's a howto link:
http://www.currentlyoffline.co.uk/square-brackets-in-html-element-name/

-- 
View this message in context: 
http://www.nabble.com/Zend_Form-and-square-brackets-in-elements%27-name-tp20483297p20822175.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to