Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

p:selectBooleanCheckbox and the label attached to it

The natural behaviour for a label attached to a checkbox button is to change the state of the button when it (the label) is clicked. This works in JSF and Richfaces.

Is there a way to make it work in Primefaces(3.5) without involving javascript ? Is this a bug ?

<p:outputLabel for="checkbox" value="Select it:" />
<p:selectBooleanCheckbox id="checkbox" label="My label" value="#{bean.value}" />
like image 948
amb Avatar asked Feb 25 '13 08:02

amb


1 Answers

It doesn't work out-of-the-box in plain JSF but in Primefaces the itemLabel attribute should do it:

<p:selectBooleanCheckbox id="checkbox" itemLabel="My label" ... />
like image 125
Matt Handy Avatar answered Sep 20 '22 06:09

Matt Handy