[html-formfu] get_element method
Dermot
paikkos at googlemail.com
Tue Sep 16 12:38:03 BST 2008
2008/9/16 Carl Franks <fireartist at gmail.com>:
> 2008/9/16 Dermot <paikkos at googlemail.com>:
$select->options(\@roles);
>
> You need get_all_element(), which does a recursive search.
>
> get_element() only searches elements which are direct children of
> whatever you're searching.
> (and if you're searching a form with auto_fieldset(1), then
> get_element() will only ever return the fieldset)
>
Ahh. Ok.
>> I have had this problem in a few different controllers in my Cat app.
>> What I have been doing is
>>
>> my $select = $form->get_all_elements({type => 'Select'});
>> $c->log->debug("Select=",join ' ', $select->[0]);
>> $select->[0]->options(\@roles);
>
> You want get_all_element() - not get_all_elements()
>
> The first returns a single element - the second returns an arrayref of
> elements, even if there's only 1 to return.
That's the tip. This works
my $select = $form->get_all_element({type => 'Select'});
$select->options(\@roles);
Thanx,
Dp.
More information about the HTML-FormFu
mailing list