2008年8月27日星期三

Re: [fw-core] Zend_Form_Element 'name' and brackets.

-- Paweł Chuchmała <pawel.chuchmala@gmail.com> wrote
(on Wednesday, 27 August 2008, 01:31 PM +0200):
> I want to create form with some checkbox. I need to get chceckbox values as
> array with
> specified keys. I create this form by my class extended Zend_Form, and add
> fields in init()
> method.
>
> Problem is that Zend_Form_Element call filterName with 'allowBrackets' = flase.
> Why?
> For Zend_Form_Element_Multicheckbox brackets are allowed, so why not for all
> elements?

Set the "isArray" property of the element:

$element->setIsArray(true);

This will append [] to the name.

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: