- java.lang.Object
-
- jakarta.faces.view.facelets.TagHandler
-
- org.omnifaces.taghandler.IgnoreValidationFailed
-
- All Implemented Interfaces:
FaceletHandler
public class IgnoreValidationFailed extends TagHandler
The
<o:ignoreValidationFailed>
taghandler allows the developer to ignore validation failures when executing anUICommand
action. This taghandler must be placed inside anUICommand
component and the parentUIForm
must be an<o:form>
. When executing an ajax action, make sure that the parentUIForm
is also included in the<f:ajax execute>
.Usage
For example:
<o:form> ... <h:commandButton value="save valid data" action="#{bean.saveValidData}"> <o:ignoreValidationFailed /> <f:ajax execute="@form" /> </h:commandButton> </o:form>
Note that the model values will (obviously) only be updated for components which have actually passed the validation. Also the validation messages will still be displayed. If you prefer to not display them, then you'd need to exclude them from rendering by
<f:ajax render>
, or to put a proper condition in therendered
attribute.- Author:
- Bauke Scholtz
- See Also:
Form
-
-
Field Summary
-
Fields inherited from class jakarta.faces.view.facelets.TagHandler
nextHandler, tag, tagId
-
-
Constructor Summary
Constructors Constructor Description IgnoreValidationFailed(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
and is new and we're in the restore view phase of a postback, then delegate toprocessIgnoreValidationFailed(UICommand)
.protected void
processIgnoreValidationFailed(UICommand command)
Check if the given command component has been invoked during the current request and if so, then instruct the parent<o:form>
to ignore the validation.-
Methods inherited from class jakarta.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
-
-
-
-
Constructor Detail
-
IgnoreValidationFailed
public IgnoreValidationFailed(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
and is new and we're in the restore view phase of a postback, then delegate toprocessIgnoreValidationFailed(UICommand)
.- Throws:
IllegalStateException
- When the parent component is not an instance ofUICommand
.IOException
-
processIgnoreValidationFailed
protected void processIgnoreValidationFailed(UICommand command)
Check if the given command component has been invoked during the current request and if so, then instruct the parent<o:form>
to ignore the validation.- Parameters:
command
- The command component.- Throws:
IllegalStateException
- When the given command component is not inside a<o:form>
.
-
-