Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting a CheckBoxGroup to render with some items already selected... how?  RSS feed

 
Phoenix Kilimba
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sirs and Madams,
I am a Visual Web JSF newbie and have been humbled by this one issue: I have User value objects which hold a List attribute of what user privileges they have. Am trying to render a checkbox group of user privileges for a chosen user with some user privileges already checked (the ones the user already has), and some not checked (potential privileges to give to the user) for the EditAUsersPrivileges page. Is this even possible? If so, how?

Profusely thanking you in advance,
Phoenix
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To the point, you want to precheck some checkboxes on page load?
If so, just set the property behind its 'value' attribute accordingly.
 
Phoenix Kilimba
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes indeed I do want to precheck some of the checkboxes, however as the component is a checkbox group as opposed to individual checkboxes I can see how you could set the value attributes on individual checkboxes but when they are part of a single component whose size is dynamic according to how many privileges a user has, how do you specify a particular checkbox relating to a particular privilege?

Thanks
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As said, preset the property behind the 'value' attribute of the input component.


That's all.
 
Phoenix Kilimba
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I have been trying for a while, am afraid am still stuck. This is the current JSP code which renders my checkboxGroup:

.

Am trying to marry your idea with my code and am not seeing how (as there is no value attribute to the input component as far as I can see, just a selected attribute). Does it matter that am using Visual Web JSF, as my code seems different from your suggestion?

Thanks in advance.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I have never used the Woodstock component library. It's already dead for more than one year and its development is abandoned since January this year. Try carefully reading their documentation or asking it at their own forum (which is as dead as the library as well).
 
Chris Walters
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you ever find a solution to this problem ? I am having the same issue. Thanks ...

Bauke Scholtz wrote:Sorry, I have never used the Woodstock component library. It's already dead for more than one year and its development is abandoned since January this year. Try carefully reading their documentation or asking it at their own forum (which is as dead as the library as well).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!