Hi Matthias,
Matthias Kahlau wrote: > Hi! > > > My HtmlSelectManyCheckbox with "spread" layout and a styleClass set is > rendered as follows: > > <table border="0"> > <tbody> > <tr><td><input type="checkbox" name="Form:Frage_4" id="Form:Frage_4" > value="1" class="surveyInput" /> die zweite (Text) </td></tr> > <tr><td><input type="checkbox" name="Form:Frage_4" id="Form:Frage_4" > value="2" class="surveyInput" /> die dritte (datum) </td></tr> > </tbody> > </table> > > This does not comply to the "Standard Html RenderKit" specification of JSF > 1.1 for the HtmlSelectManyCheckbox renderer: You're right, layout="spread" is out of spec ;-). > > "Render a "table" element. If the "styleClass" is specified, render the > value of the "styleClass" attribute as the value of the "class" attribute on > the "table" element. If the "style", "border" attributes are specified, pass > them thru. If the "layout" attribute is specified, and its value is > "pageDirection", render the children elements vertically, otherwise > horizontally, in the table. If any of the children are an instance of > SelectItemGroup, render them as a nested table. Each of the children are > ultimately rendererd as follows. Render a "label" element. Inside of the > "label", render an "input" element of "type" "checkbox" for each child > component. ..." > > The class "surveyInput" (set to the HtmlSelectManyCheckbox component) is > rendered only as attribute in the <input> elements themselves, but not for > the table. Furthermore, the Tomahawk HtmlSelectManyCheckbox renderer doesn't > render a <label> element around each <input> element. Why did you choose a > different markup? > > > In contrast, the Tomahawk HtmlSelectOneRadio component's markup ("spread" > layout) does contain <label> elements as required, but shows the same > behaviour regarding the styleClass attribute of the component: > > <table border="0"><tbody> > <tr><td><label><input type="radio" name="Form:Frage_2" checked="checked" > value="1" class="surveyInput" /> die zweite > (Texteingabe)</label> </td></tr> > <tr><td><label><input type="radio" name="Form:Frage_2" value="2" > class="surveyInput" /> die dritte (nur > Ganzzahlen)</label> </td></tr> > </tbody></table> > > As Hans Bergsten describes in his JSF book, the <label> elements should also > specify their for attributes, which isn't the case for the code snippets > shown (using MyFaces Nightly 20051130). > > > The <label> element is my lifesaver in changing the format of the radio > button labels, and I really need them for the checkboxes, too. I don't know > how to change the format of the checkbox labels, because I can't change the > <table>, <tbody>, <tr> or <td> elements per CSS globally, and applying a > style to the HtmlPanelGrid containing the checkbox controls is not > sufficient in my case because there's a global definition for the <td> > element which a must not change ...! > > Do you have an idea of how I could change the checkbox label format? not sure, but maybe you can use the descendant modifier of css: http://www.w3.org/TR/REC-CSS2/selector.html#descendant-selectors try: ----------- [css] --------------------- #panelGridId td { // css for label tds here } ----------- [/css] --------------------- Or even better: Create a patch for this to accept a 'labelClass' attribute and rendering the label tag for checkboxes also. Regards, Volker > > > > Regards, > > Matthias > -- Don't answer to From: address! Mail to this account are droped if not recieved via mailinglist. To contact me direct create the mail address by concatenating my forename to my senders domain.