GeeCON Prague 2014*
The moose likes JSF and the fly likes h:selectBooleanCheckbox required validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "h:selectBooleanCheckbox required validation" Watch "h:selectBooleanCheckbox required validation" New topic
Author

h:selectBooleanCheckbox required validation

ya ji
Ranch Hand

Joined: Jul 14, 2008
Posts: 40
How to validate required for h:selectBooleanCheckbox?

Code:
<h:selectBooleanCheckbox label="User Group" required="true" id="selusergroups" value="#{UserBean.ugSelection[usergroup]}" />

it's now working.
Bhaskar GR
Greenhorn

Joined: Jun 13, 2008
Posts: 28
You have to generate validation in backing bean
ya ji
Ranch Hand

Joined: Jul 14, 2008
Posts: 40
Hi Bhaskar,

Could you give me some idea about that or provide some sample code? thanks,I'm a freshman of JSF
Venkat Sadasivam
Ranch Hand

Joined: May 10, 2008
Posts: 139
What is the kind of validation are you expecting in boolean check box?

As I understand it has only two condition either checked or unchecked. I feel there is no validation is required for boolean check box.


“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
ya ji
Ranch Hand

Joined: Jul 14, 2008
Posts: 40
A checkbox group, validate at least one checkbox checked.
Venkat Sadasivam
Ranch Hand

Joined: May 10, 2008
Posts: 139
In that case you have to use <h:selectManyCheckbox />
 
GeeCON Prague 2014
 
subject: h:selectBooleanCheckbox required validation