o:validateAll
validates validates if ALL of the given UIInput
components have been filled out. The default message is
{0}: Please fill out all of those fields
This validator must be placed inside the same UIForm
as the UIInput
components
in question. The UIInput
components must be referenced by a space separated collection of
their client IDs in the components
attribute. This validator can be placed anywhere in the
form, but keep in mind that the components will be validated in the order as they appear in the form.
So if this validator is been placed before all of the components, then it will be executed before any of
the component's own validators. If this validator fails, then the component's own validators will not be
fired. If this validator is been placed after all of the components, then it will be executed after any
of the component's own validators. If any of them fails, then this validator will not be exeucted. It
is not recommended to put this validator somewhere in between the referenced components as the resulting
behaviour may be confusing. Put this validator either before or after all of the components, depending
on how you would like to prioritize the validation.
<o:validateMultipleFields id="myId" components="foo bar baz" /> <h:message for="myId" /> <h:inputText id="foo" /> <h:inputText id="bar" /> <h:inputText id="baz" />
By default, in an invalidating case, all of the referenced components will be marked invalid and a faces message will
be added on the client ID of this validator component. The default message can be changed by the message
attribute. Any "{0}" placeholder in the message will be substituted with a comma separated string of labels of the
referenced input components.
<o:validateMultipleFields components="foo bar baz" message="{0} are wrong!" />
You can use invalidateAll="false"
to mark only those components which are actually invalid as invalid.
In case of for example "input all" or "input all or none" validation, that would be only the fields which are left
empty.
<o:validateMultipleFields components="foo bar baz" message="{0} are wrong!" invalidateAll="false" />
The faces message can also be shown for all of the referenced components using showMessageFor="@all"
.
<o:validateMultipleFields components="foo bar baz" message="This is wrong!" showMessageFor="@all" /> <h:inputText id="foo" /> <h:message for="foo" /> <h:inputText id="bar" /> <h:message for="bar" /> <h:inputText id="baz" /> <h:message for="baz" />
The faces message can also be shown for only the invalidated components using showMessageFor="@invalid"
.
<o:validateMultipleFields components="foo bar baz" message="This is wrong!" showMessageFor="@invalid" />
The faces message can also be shown as global message using showMessageFor="@global"
.
<o:validateMultipleFields components="foo bar baz" message="This is wrong!" showMessageFor="@global" />
The faces message can also be shown for specific components referenced by a space separated collection of their
client IDs in showMessageFor
attribute.
<o:validateMultipleFields components="foo bar baz" message="This is wrong!" showMessageFor="foo baz" />
The showMessageFor
attribute defaults to @this
.
The validator can be disabled by the disabled
attribute. It accepts a request based EL expression.
<o:validateMultipleFields components="foo bar baz" disabled="#{param.validationDisabled}" />
There is a read-only validationFailed
attribute which can be used to determine if the validation by
this component has failed.
<o:validateMultipleFields id="myId" binding="#{myId}" components="foo bar baz" /> <h:panelGroup rendered="#{myId.validationFailed}"> Validation has failed! <h:message for="myId" /> </h:panelGroup>
Info | Value |
---|---|
Component Type | org.omnifaces.component.validator.ValidateAll |
Handler Class | None |
Renderer Type | None |
Description | None |
Name | Required | Type | Description |
---|---|---|---|
binding | false | jakarta.el.ValueExpression
(must evaluate to jakarta.faces.component.UIComponent )
|
The ValueExpression linking this component to a property in a backing bean.
|
components | true | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| The space separated collection of client IDs of UI input components to be validated. |
disabled | false | jakarta.el.ValueExpression
(must evaluate to boolean )
|
Whether the validation should be disabled or not. Defaults to false .
|
id | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| The component identifier for this component. This value must be unique within the closest parent component that is a naming container. |
invalidateAll | false | jakarta.el.ValueExpression
(must evaluate to boolean )
| Whether to invalidate all fields or only those which are empty. |
message | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| The validator message to be shown on failure. Any "{0}" placeholder in the message will be substituted with a comma separated string of labels of the referenced input components. |
rendered | false | jakarta.el.ValueExpression
(must evaluate to boolean )
| Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true. |
showMessageFor | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| The identifier for which this validator should show the message. Defaults to "@this" which is the validator component itself. Other available values are "@all" which will show the message for all of the referenced components and "@invalid" which will show the message for only the invalidated components. Any other space separated value will be treated as client ID of UI input component. |
Output generated by Vdldoc View Declaration Language Documentation Generator.