Thanks again Carl,
your guess is correct: I'm using auto_fieldset()
Without it everthing works as I expected.
Am 17.09.2008 um 12:24 schrieb Carl Franks:
2008/9/17 goetz <[EMAIL PROTECTED]>:
Hallo,
I trie to use get_element with no success.
The debug output is always undef.
When I use get_field or get_all_element I get the correct
output.
Any hint?
Her are the details:
in the config file:
- type: Select
name: name
label: name
in my controler:
my $test = $form->get_element({ type => 'Select'}); # undef !!!!!!!
my $test01= $form->get_elements({type => 'Select'});
my $field = $form->get_field(name => 'name');
my $select= $form->get_all_element({type => 'Select'});
As that's only a snippet of the form config - I'm going to take a
guess that you're either using auto_fieldset() - or the Select menu is
nested by some other means, such as an explicit block.
In which case, this behaviour is correct.
$form->get_element() only returns direct children of the form object.
If the Select element is nested within a fieldset or block, it'll
never be returned.
$form->get_elements() also won't return nested children, but it won't
be undef, it'll just return an empty arrayref.
$form->get_all_elements() does a recursive search, so it'll return the
Select element.
$form->get_field() also does a recursive search, so that'll work.
If you're after a field, then get_field() / get_fields() are
probably best.
Cheers,
Carl
_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu