java.lang.Object
jakarta.faces.view.facelets.TagHandler
org.omnifaces.taghandler.SkipValidators
- All Implemented Interfaces:
FaceletHandler
The <o:skipValidators> taghandler allows the developer to entirely skip validation when executing an UICommand or
ClientBehaviorHolder action. This taghandler must be placed inside an UICommand or ClientBehaviorHolder component (client behavior
holder components are those components supporting <f:ajax>).
Usage
For example, when adding a new row to the data table, you'd like to not immediately validate all empty rows.
<h:form>
<h:dataTable value="#{bean.items}" var="item">
<h:column>
<h:inputText value="#{item.value}" required="true" />
</h:column>
</h:dataTable>
<h:commandButton value="add new row" action="#{bean.add}">
<o:skipValidators />
</h:commandButton>
<h:commandButton value="save all data" action="#{bean.save}" />
<h:messages />
</h:form>
Note that converters will still run and that model values will still be updated. This behavior is by design.
- Since:
- 2.3
- Author:
- Michele Mariotti, Bauke Scholtz
-
Field Summary
Fields inherited from class jakarta.faces.view.facelets.TagHandler
nextHandler, tag, tagId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(FaceletContext context, UIComponent parent) If the parent component is an instance ofUICommandorClientBehaviorHolder, and is new, and we're in the restore view phase of a postback, then delegate toprocessSkipValidators(UIComponent).protected voidprocessSkipValidators(UIComponent parent) Check if the given component has been invoked during the current request and if so, then register the skip validators event listener which removes the validators duringPreValidateEventand restores them duringPostValidateEvent.Methods inherited from class jakarta.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
-
Constructor Details
-
SkipValidators
The tag constructor.- Parameters:
config- The tag config.
-
-
Method Details
-
apply
If the parent component is an instance ofUICommandorClientBehaviorHolder, and is new, and we're in the restore view phase of a postback, then delegate toprocessSkipValidators(UIComponent).- Throws:
IllegalStateException- When the parent component is not an instance ofUICommandorClientBehaviorHolder.IOException
-
processSkipValidators
Check if the given component has been invoked during the current request and if so, then register the skip validators event listener which removes the validators duringPreValidateEventand restores them duringPostValidateEvent.- Parameters:
parent- The parent component of this tag.
-