[Catalyst] HTML::Widget styling
Bogdan Lucaciu
bogdan at wiz.ro
Fri Jul 28 18:50:36 CEST 2006
On Fri, 2006-07-28 at 17:31 +0100, Nigel Metheringham wrote:
> [Please point me to the right place if there is a better place for
> HTML::Widget questions]
http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget :)
> If I have a simple form of mixed elements produced in HTML::Widget, all
> the components of the HTML output have ID tags, and the actual INPUT
> elements have classes (corresponding to the type - which is actually
> superfluous since you can style them using something like a CSS
> 'input[type=submit' selector).
uhm, do attribute selectors work in IE?
> However there is no good way of selecting labels which go with
> particular types of INPUT element - for example I might (and do!) wish
> to differently style checkbox labels to those for text elements.
>
> By default labels have no class - unless there is an error in form
> validation.
>
> I can't work out a good way to generically style checkbox (or select
> or...) labels. My CSS fu is not that wonderful, so maybe I have missed
> something...
>
> I have produced a hack which overloads mk_label and adds a default class
> to each label, but frankly its not good since it will all fall apart if
> there is a validation error (which overrides the label class).
>
> Any solutions or ideas?
1. create a custom container class like this one:
http://search.cpan.org/src/CFRANKS/HTML-Widget-1.07/t/lib/TestContainer.pm
2. set it as your container like this:
http://search.cpan.org/~cfranks/HTML-Widget-1.07/lib/HTML/Widget/Element.pm#%24self-%3Econtainer_class(%24class)
You can even set it for all your elements:
HTML::Widget::Element->container_class('TestContainer');
have fun
--
Bogdan Lucaciu <bogdan at wiz.ro>
More information about the Catalyst
mailing list