2009/4/20 Michael Reddick <michael.redd...@gmail.com>: > I'm trying to subclass the Select element and be able to change which > options are added via a variable (user_type) in the form config. The > variable (user_type) isn't being initialized when _populate_options is > called. How should I be doing this? Here is the code:
How are you setting 'user_type' ? If it's in a config file, such as: - type: UserSelect name: foo user_type: bar then internally, HTML-FormFu is essentially doing: my $elem = $form->element({ type => 'UserSelect', name => 'foo', }); $elem->user_type('bar'); which is why 'user_type' isn't yet set in _populate_options(), when it's called by new(). I'd probably do it during process() instead: sub process { my $self = shift; $self->_populate_options if !...@{ $self->options }; $self->next::method( @_ ); } _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu