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

Carl Franks fireartist at gmail.com
Thu Oct 11 17:27:49 GMT 2007


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).

Or you could do something like:
    $form->get_element({type=>'Fieldset'})->get_element();

Carl



More information about the HTML-FormFu mailing list