[html-formfu] setup() method

Carl Franks fireartist at gmail.com
Wed Jul 11 15:25:09 GMT 2007


On 11/07/07, Tobias Kremer <list at funkreich.de> wrote:
> > On 11/07/07, Tobias Kremer <list at funkreich.de> wrote:
> > > which makes my element appear twice in the form if placed inside a block
> > > element (e.g. a simple_table) because my setup method is called once in
> > > ObjectUtil and a second time from the block element.
> > >
> > > Any ideas on how to fix this? Is it really neccessary to have the block
> > > element call setup again for all the elements it's enclosing?
> >
> > I'm in holiday mode - so my mind's already going fuzzy - hope there's
> > still enough of it left to help...
> >
> > Where abouts in ObjectUtil is it being called?
>
> In _require_element right after populate()
>
> > Why's the setup being called twice?
>
> For the first time for every element in the form (via ObjectUtil, see above)
> and then a second time if an element is contained within a block element
> because block.pm overrides setup() to call setup() on every sub element
> of itself. So setup() is called twice for elements which are contained in a
> block element.
>
> > What does your custom element subclass? And what elements does it contain?
>
> It subclasses multi to build up a three-select-field date element. See the
> other mail I just fired off to the list.
>
> > Is the problem that your custom element's setup method is still
> > calling SUPER::setup() (extending) when you should be overriding
> > setup() ?
>
> Nope, it's not :)

ah, yes, you're right - block shouldn't be calling setup() on it's children.

Do you have svn commit yet? If you get a gmail account, I can give you
write access.

Carl



More information about the HTML-FormFu mailing list