0

I am new to this Website. My issue is related to SelectBooleanCheckbox in primefaces. How to check Checkbox when user click on label?

Here is my xhtml

<h:panelGroup id="supplementaryProvision" layout="block">
            <h:panelGroup rendered="#{registrationHandler.showSupplProvisionsCheck}">
                <div class="row">
                    <div class="col-sm-offset-5 col-md-offset-3 col-sm-7 col-md-5">
                        <div class="checkbox">
                            <p:selectBooleanCheckbox id="provisionCheck" value="#{registrationHandler.registrationDto.supplProvisionCheck}"
                                label="#{msg.addtionalTerms}" />

                            <h:outputLabel for="provisionCheck" id="provisionCheckLabel">
                                <h:outputText value="#{msg.agreeForeignerTerms} *" />
                            </h:outputLabel>
                        </div>
                    </div>
                </div>
            </h:panelGroup>
        </h:panelGroup>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
capitann
  • 1
  • 2

1 Answers1

1

Use itemLabel, and remove the outputLabel with id provisionCheckLabel:

<p:selectBooleanCheckbox
    id="provisionCheck"
    itemLabel="#{msg.agreeForeignerTerms} *"
    value="#{registrationHa...}"
    label="#{msg.addtionalTerms}" />