Consider this simple example. If I have a form like this I obviously get a validation error when submitting with no value in the inputText:
<h:form id="testForm" prependId="false">
<h:selectOneMenu
id="testSelectOneMenu"
value="#{backButtonTestBean.selection}">
<f:selectItem itemValue="mickey" itemLabel="Mickey" />
<f:selectItem itemValue="mouse" itemLabel="Mouse" />
<f:ajax execute="@this" render="panel" />
</h:selectOneMenu>
<h:panelGroup layout="block" id="panel">
<h:panelGroup layout="block">
<h:inputText id="requiredField" required="true" />
</h:panelGroup>
</h:panelGroup>
<h:commandButton value="submit" action="#{backButtonTestBean.submit}" />
</h:form>
But when I re-render the panelGroup w/ f:ajax the required attribute is not being honored and I can submit with an empty value:
<h:form id="testForm" prependId="false">
<h:selectOneMenu
id="testSelectOneMenu"
value="#{backButtonTestBean.selection}">
<f:selectItem itemValue="mickey" itemLabel="Mickey" />
<f:selectItem itemValue="mouse" itemLabel="Mouse" />
<f:ajax execute="@this" render="panel" />
</h:selectOneMenu>
<h:panelGroup layout="block" id="panel">
<h:panelGroup layout="block" rendered="#{backButtonTestBean.selection == 'mouse'}">
<h:inputText id="requiredField" required="true" />
</h:panelGroup>
</h:panelGroup>
<h:commandButton value="submit" action="#{backButtonTestBean.submit}" />
</h:form>
I'm testing in mojarra 2.1.1. Any advice is appreciated.