-
Available since OmniFaces 1.1
The <o:validateAll>
validates if ALL of the given UIInput
components have been filled out. One could of course also just put required="true"
on all of those UIInput
components, but sometimes it's desireable to invalidate all of those fields and/or to have just only one message for it, which isn't possible with the standard Faces API.
The default message is
{0}: Please fill out all of those fields
For general usage instructions, refer ValidateMultipleFields
documentation.
Demo
Demo source code
<h:form>
<h3>Please fill out all of those fields</h3>
<o:validateAll id="all" components="foo bar baz" />
<h:panelGrid columns="3">
<o:outputLabel for="foo" value="Foo" />
<h:inputText id="foo" />
<h:message for="foo" />
<o:outputLabel for="bar" value="Bar" />
<h:inputText id="bar" />
<h:message for="bar" />
<o:outputLabel for="baz" value="Baz" />
<h:inputText id="baz" />
<h:message for="baz" />
<h:panelGroup />
<h:commandButton value="submit">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<h:panelGroup>
<h:message for="all" />
<h:outputText value="OK!" rendered="#{facesContext.postback and not facesContext.validationFailed}" />
</h:panelGroup>
</h:panelGrid>
</h:form>
Documentation & Sources