I am writing a JSF page that requires users to click on a checkbox (similar to accepting a license agreement) I have the following code:
<h:selectBooleanCheckbox value="#{checkBoxManagedBean.checkBoxValue}" required="true" id="jsfcheckBox" > </h:selectBooleanCheckbox> <h:outputLabel value="accept rule label" for="jsfcheckBox" /> <h:message for="jsfcheckBox"/> <br/> <h:commandButton id="loginButton" value="Submit" action="#{checkBoxManagedBean.testAction}"/>
I set the value required = true, but the check for the checkbox fails. I donβt see the message being displayed on the page.
I tried f: validateRequired, even this does not work.
<h:selectBooleanCheckbox value="#{checkBoxManagedBean.checkBoxValue}" required="true" id="jsfcheckBox" > <f:validateRequired for="jsfcheckBox"></f:validateRequired> </h:selectBooleanCheckbox> <h:outputLabel value="CheckBox label" for="jsfcheckBox" /> <h:message for="jsfcheckBox"/> <br/> <h:commandButton id="loginButton" value="Submit" action="#{checkBoxManagedBean.testAction}"/>
The page does not have time, a flag, all buttons are visible, my expectation receives a verification message when the flag is not selected before the button is clicked.
BTW, is this a JSF specification that is required = true does not perform any validation?
source share