[html-formfu] nested elements, and $form->get_element

Will Hawes wdhawes at gmail.com
Fri Oct 12 18:09:00 GMT 2007


On 11/10/2007, Ruben Fonseca <rubenfonseca at di.uminho.pt> wrote:
>
> On 2007/10/11, at 17:27, Carl Franks wrote:
>
> > On 11/10/2007, Ruben Fonseca <rubenfonseca at di.uminho.pt> wrote:
> >> Hi
> >>
> >> I noticed that my $form->get_element stopped working. I digged a lot
> >> until I find the cause.
> >>
> >> It seems that get_element (and get_elements) search on $form-
> >>> _elements that, AFAIK, are the elements *after* the rendering is
> >> passed on them?
> >>
> >> Well my problem is that I have several elements nested on a fieldset,
> >> and get_element couldn't find the nested elements, only the outer
> >> ones.
> >>
> >> My solution to the problem was to change on ObjectUtil.pm the calls
> >> to $form->_elements to $form->get_all_elements on "sub get_elements".
> >> Can you confirm this?
> >
> > Hi,
> >
> > There's a get_all_element() method which will do a recursive search
> > and only return the first found (though if you don't provide a name or
> > type argument, then it'll still only return the outer fieldset).
>
> Oh I didn't know that I could pass parameters to get_all_element()
> like the get_element method!
>
> Problem solved, thank you :)
>
> Ruben

Looks like this question has now been added to the faq in SVN. I've
added a few more lines to the documentation for get_all_elements to
explicitly state that it accepts parameters.



More information about the HTML-FormFu mailing list