On Mon, Feb 8, 2010 at 2:12 PM, Aleksey Zapparov <[email protected]>wrote:
2010/2/8 David Mintz <[email protected]>: [snip] > But! [I will need to flatten the return of getMessages()] in various > places around the application, so I > am considering the best approach. A controller action helper that mangles > $form->getMessages() for me? Or have all my complex forms extend a base > class that overrides getMessages()? Or... ? > > Hello, > > I suggest you to extand Zend_Form with your own, let's call it App_Form. > But I do not recommend to override Zend_Form's getMessges() method, instead > I suggest to create new one, let's call it getMessagesFlatten() where > you'll > implement necessary logic. > > Or, if you don't need all features of Zend_Form extending, I think it's > better to re-write your jQuery plugin/script. > > Just for curiosity's sake, why not overrride getMessages()? My "simple" forms will subclass Zend_Form directly, and my "compound" (subform-containing) forms will extend my Form_CompoundForm which has its own getMessages() implementation, so that I can rely on getMessages() to give me what I want. -- Support real health care reform: http://phimg.org/ -- David Mintz http://davidmintz.org/
