KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I writing JSF page, which requires users to click on a checkbox (similar to accepting the license agreement) I have following code in place: <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 am setting the required=true, but there is no validation happening for checkbox. I dont see any message getting displayed in the page for checkbox. I have tried f:validateRequired, even this is not working. <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 doesnt have any time issue, checkbox, buttons everything visible, my expectation is getting a validation message, when checkbox is not selected before button is pressed. BTW, is it JSF specification that required=true doesn't really execute any validation??
Tags (comma-separated)
Save Edits
Cancel