Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6534187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:13:14+00:00 2026-05-25T10:13:14+00:00

How to reference each individual checkbox in the outputLabel so that when I click

  • 0

How to reference each individual checkbox in the outputLabel so that when I click on item’s label, it would effectively be the same as if I clicked on the checkbox?

<rich:dataGrid value="#{all}" var="item" columns="3">
    <h:outputLabel value="#{item.name}" for="what_here?" />
    <h:selectBooleanCheckbox value="#{item.selectedForLaterUse}" id="item#{item.id}" />
</rich:dataGrid>

A possibility that comes first to mind is of course

  for="item#{item.id}"

but since jsf id’s are relative, it would not work, right?

There is also one option to use selectManyCheckbox but that doesn’t seem to give an option to use columns.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:13:15+00:00Added an answer on May 25, 2026 at 10:13 am

    You do not need to do it. JSF does it for you. Just specify a fixed ID as long as it’s in the same scope.

    <rich:dataGrid value="#{all}" var="item" columns="3">
        <h:outputLabel value="#{item.name}" for="item" />
        <h:selectBooleanCheckbox value="#{item.selectedForLaterUse}" id="item" />
    </rich:dataGrid>
    

    JSF will generate the proper HTML accordingly. Open page in browser, rightclick and do View Source to see it yourself. The generated HTML element IDs are in this particular case composed of all parent NamingContainer components and the current item index.

    Here’s an example of the generated output, assuming that you’re giving all NamingContainer components a fixed ID like <h:form id="form"> and <rich:dataGrid id="grid"> (otherwise JSF will autogenerate IDs like j_idt1 and so on, which would work perfectly fine as well but is not immediately readable):

    <table id="form:grid" class="rf-dg">
      <tbody id="form:grid:dgb" class="rf-dg-body">
        <tr class="rf-dg-r">
          <td class="rf-dg-c">
            <label for="form:grid:0:item">one</label>
            <input id="form:grid:0:item" type="checkbox" name="form:grid:0:item" />
          </td>
          <td class="rf-dg-c">
            <label for="form:grid:1:item">two</label>
            <input id="form:grid:1:item" type="checkbox" name="form:grid:1:item" />
          </td>
          <td class="rf-dg-c">
            <label for="form:grid:2:item">three</label>
            <input id="form:grid:2:item" type="checkbox" name="form:grid:2:item" />
          </td>
        </tr>
      </tbody>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is in reference to the question previously asked The problem here is, each
I have some JavaScript/jQuery code that watches for the changed event on a checkbox:
I have a python dictionary with a thousand items. Each item is, itself, a
I have a function that has a large number if individual input parameters, the
I have a routine that will be creating individual tables (Sql Server 2008) to
I have a Collection of items that I would like to display the Total
I have an agent program that will launch multiple instance of the same executable.
In .Net/C# Application, I have data structures which have references to each other. When
My application supports internationalization and localization, each user can choose his preference language and
With reference to Problem with date day/month reversing on save I have further noted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.