public class SkipValidators extends TagHandler
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>
).
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.
nextHandler, tag, tagId
Constructor and Description |
---|
SkipValidators(TagConfig config)
The tag constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(FaceletContext context,
UIComponent parent)
If the parent component is an instance of
UICommand or ClientBehaviorHolder , and is new, and
we're in the restore view phase of a postback, then delegate to processSkipValidators(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 during
PreValidateEvent and restores them during
PostValidateEvent . |
getAttribute, getRequiredAttribute, toString
public SkipValidators(TagConfig config)
config
- The tag config.public void apply(FaceletContext context, UIComponent parent) throws IOException
UICommand
or ClientBehaviorHolder
, and is new, and
we're in the restore view phase of a postback, then delegate to processSkipValidators(UIComponent)
.IllegalStateException
- When the parent component is not an instance of UICommand
or
ClientBehaviorHolder
.IOException
protected void processSkipValidators(UIComponent parent)
PreValidateEvent
and restores them during
PostValidateEvent
.parent
- The parent component of this tag.Copyright © 2012–2022 OmniFaces. All rights reserved.