[html-formfu] overriding container css class
Carl Franks
fireartist at gmail.com
Wed Apr 22 13:13:46 GMT 2009
2009/4/21 Michael Reddick <michael.reddick at 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
More information about the HTML-FormFu
mailing list