2008/9/16 Dermot <[EMAIL PROTECTED]>: > Hi, > > I cannot get the get_element method to work on my installation. > > Catalyst::Controller::HTML::FormFu > > my $select = $form->get_element({type => 'Select'}); # There > is only one select element in my yml form > $c->log->debug("Select=",$select); > $select->options([EMAIL PROTECTED]);
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) > 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([EMAIL PROTECTED]); 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. Carl _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu