2009/4/21 Michael Reddick <michael.redd...@gmail.com>:
> I have a subclass of Element::Select. I want the css class for the container
> to be the same as Element::Select. Is there a better way to do it than
> overriding sub type? Will that cause me other problems?

If you don't need to override, but can live with just adding "select"
to the class, you could do this:

package HTML::FormFu::Element::MyApp::MySelect;

use HTML::FormFu::Util qw( append_xml_attribute );

sub new {
    my $self = shift->next::method( @_ );

    append_xml_attribute(
        $self->container_attributes,
        'class',
        'select',
    );

return $self;
}

1;

You'd end up with something like class="myappmyselect select",
so any CSS targetting ".select" will still work.

Carl

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to