Class ValidateAll

All Implemented Interfaces:
PartialStateHolder, StateHolder, TransientStateHolder, ComponentSystemEventListener, FacesListener, SystemEventListenerHolder, EventListener, MultiFieldValidator

public class ValidateAll extends ValidateMultipleFields

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.

Since:
1.1
Author:
Bauke Scholtz
See Also:
  • Field Details

    • COMPONENT_TYPE

      public static final String COMPONENT_TYPE
      The component type, which is "org.omnifaces.component.validator.ValidateAll".
      See Also:
  • Constructor Details

    • ValidateAll

      public ValidateAll()
  • Method Details

    • validateValues

      public boolean validateValues(FacesContext context, List<UIInput> inputs, List<Object> values)
      Validate if all is filled out.
      Parameters:
      context - The faces context to work with.
      inputs - The input components whose values are to be validated.
      values - The values of the input components to be validated, in the same order as the components.
      Returns:
      true if validation is successful, otherwise false (and thus show the message).
    • shouldInvalidateInput

      protected boolean shouldInvalidateInput(FacesContext context, UIInput input, Object value)
      In an invalidating case, invalidate only those inputs which have an empty value.
      Overrides:
      shouldInvalidateInput in class ValidateMultipleFields
      Parameters:
      context - The faces context to work with.
      input - The input component which may need to be invalidated.
      value - The value of the input component.
      Returns:
      Whether in in an invalidating case the given input component should be marked invalid