The <o:validateMultiple> allows the developer to validate multiple fields by either a custom
validator method:
<o:validateMultiple id="myId" components="foo bar baz" validator="#{bean.someMethod}" />
<h:message for="myId" />
<h:inputText id="foo" />
<h:inputText id="bar" />
<h:inputText id="baz" />
whereby the method has the following signature (method name is free to your choice):
public boolean someMethod(FacesContext context, List<UIInput> components, List<Object> values) {
// ...
}
Or, by a managed bean instance which implements the MultiFieldValidator interface:
<o:validateMultiple id="myId" components="foo bar baz" validator="#{validateValuesBean}" />
<h:message for="myId" />
<h:inputText id="foo" />
<h:inputText id="bar" />
<h:inputText id="baz" />
@ManagedBean
@RequestScoped
public class ValidateValuesBean implements MultiFieldValidator {
@Override
public boolean validateValues(FacesContext context, List<UIInput> components, List<Object> values) {
// ...
}
}
Note that this validator does not throw ValidatorException, but returns a boolean! Message
handling and invalidation job is up to the ValidateMultipleFields implementation who will call this method.
You can customize the message by the message attribute of the tag. Refer ValidateMultipleFields
documentation for general usage instructions.
| Info | Value |
|---|---|
| Component Type | org.omnifaces.component.validator.ValidateMultiple |
| Handler Class | org.omnifaces.component.validator.ValidateMultipleHandler |
| 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. |
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 actually invalid as per
#shouldInvalidateInput(FacesContext, UIInput, Object) |
message | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The validation message to be shown on failure. Any "{0}" placeholder in the message will be substituted with a comma separated collection of labels of the input fields. |
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", "@invalid", "@global" and
"@violating". Any other space separated value will be treated as client ID of UI input component. |
validateMethod | false | jakarta.el.ValueExpression
(must evaluate to jakarta.el.MethodExpression)
| The validator method expression. |
validator | false | jakarta.el.ValueExpression
(must evaluate to org.omnifaces.validator.MultiFieldValidator)
| The validator instance. |
Output generated by Vdldoc View Declaration Language Documentation Generator.