java.lang.Object
jakarta.faces.component.UIComponent
jakarta.faces.component.UIComponentBase
org.omnifaces.component.validator.ValidatorFamily
org.omnifaces.component.validator.ValidateMultipleFields
org.omnifaces.component.validator.ValidateAllOrNone
- All Implemented Interfaces:
PartialStateHolder,StateHolder,TransientStateHolder,ComponentSystemEventListener,FacesListener,SystemEventListenerHolder,EventListener,MultiFieldValidator
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe component type, which is "org.omnifaces.component.validator.ValidateAllOrNone".Fields inherited from class org.omnifaces.component.validator.ValidatorFamily
COMPONENT_FAMILYFields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanshouldInvalidateInput(FacesContext context, UIInput input, Object value) In an invalidating case, invalidate only those inputs which have an empty value.booleanvalidateValues(FacesContext context, List<UIInput> inputs, List<Object> values) Validate if all or none is filled out.Methods inherited from class org.omnifaces.component.validator.ValidateMultipleFields
collectComponents, collectValues, getComponents, getMessage, getShowMessageFor, isDisabled, isInvalidateAll, isValidationFailed, setComponents, setDisabled, setInvalidateAll, setMessage, setShowMessageFor, showMessage, validateComponents, validateHierarchyMethods inherited from class org.omnifaces.component.validator.ValidatorFamily
encodeChildren, getFamily, getRendersChildren, processDecodes, processUpdates, processValidatorsMethods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeAll, encodeBegin, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getPassThroughAttributes, getRenderer, getRendererType, invokeOnComponent, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, visitTreeMethods inherited from class jakarta.faces.component.UIComponent
getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, subscribeToEvent, unsubscribeFromEvent
-
Field Details
-
COMPONENT_TYPE
The component type, which is "org.omnifaces.component.validator.ValidateAllOrNone".- See Also:
-
-
Constructor Details
-
ValidateAllOrNone
public ValidateAllOrNone()
-
-
Method Details
-
validateValues
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:
trueif validation is successful, otherwisefalse(and thus show the message).
-
shouldInvalidateInput
In an invalidating case, invalidate only those inputs which have an empty value.- Overrides:
shouldInvalidateInputin classValidateMultipleFields- 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
-