2008年8月25日星期一

Re: [fw-mvc] Override name of elements in Zend_Form

-- Gordon Ross <gr306@ucs.cam.ac.uk> wrote
(on Monday, 25 August 2008, 09:34 PM +0100):
> Zend does a great job of auto-naming elements most of the time. (i.e.
> by forming the id from the element's location in the structure of the
> Zend_Form)
>
> However, occasionally, I'd like to override this completely. Is there
> a way to stop Zend doing it's thing to the name ?

Call one of:

* $element->id = 'someidentifier'
* $element->setAttrib('id', 'someidentifier');

or, alternately, pass the 'id' key in the configuration options passed
to the element.

The id is only auto-populated if not explicitly passed in.

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

没有评论: