Class ValidateAllOrNone

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

public class ValidateAllOrNone extends ValidateMultipleFields

The <o:validateAllOrNone> validates if at least ALL of the given UIInput components have been filled out or that NONE of the given UIInput components have been filled out.

The default message is

{0}: Please fill out all or none of those fields

For general usage instructions, refer ValidateMultipleFields documentation.

Author:
Bauke Scholtz
See Also:
  • Field Details

    • COMPONENT_TYPE

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

    • ValidateAllOrNone

      public ValidateAllOrNone()
  • Method Details

    • validateValues

      public boolean validateValues(FacesContext context, List<UIInput> inputs, List<Object> values)
      Validate if all or none 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