- java.lang.Object
-
- jakarta.faces.view.facelets.TagHandler
-
- org.omnifaces.taghandler.SkipValidators
-
- All Implemented Interfaces:
FaceletHandler
public class SkipValidators extends TagHandler
The
<o:skipValidators>
taghandler allows the developer to entirely skip validation when executing anUICommand
orClientBehaviorHolder
action. This taghandler must be placed inside anUICommand
orClientBehaviorHolder
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 Constructor Description SkipValidators(TagConfig config)
The tag constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(FaceletContext context, UIComponent parent)
If the parent component is an instance ofUICommand
orClientBehaviorHolder
, and is new, and we're in the restore view phase of a postback, then delegate toprocessSkipValidators(UIComponent)
.protected void
processSkipValidators(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 duringPreValidateEvent
and restores them duringPostValidateEvent
.-
Methods inherited from class jakarta.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
-
-
-
-
Constructor Detail
-
SkipValidators
public SkipValidators(TagConfig config)
The tag constructor.- Parameters:
config
- The tag config.
-
-
Method Detail
-
apply
public void apply(FaceletContext context, UIComponent parent) throws IOException
If the parent component is an instance ofUICommand
orClientBehaviorHolder
, 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 ofUICommand
orClientBehaviorHolder
.IOException
-
processSkipValidators
protected void processSkipValidators(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 duringPreValidateEvent
and restores them duringPostValidateEvent
.- Parameters:
parent
- The parent component of this tag.
-
-