org.omnifaces.taghandler
Class IgnoreValidationFailed

java.lang.Object
  extended by javax.faces.view.facelets.TagHandler
      extended by org.omnifaces.taghandler.IgnoreValidationFailed
All Implemented Interfaces:
javax.faces.view.facelets.FaceletHandler

public class IgnoreValidationFailed
extends javax.faces.view.facelets.TagHandler

The <o:ignoreValidationFailed> allows the developer to ignore validation failures when executing an UICommand action. This taghandler must be placed inside an UICommand component and the parent UIForm must be an <o:form>. When executing an ajax action, make sure that the parent UIForm is also included in the <f:ajax execute>.

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 the rendered attribute.

Author:
Bauke Scholtz
See Also:
Form

Field Summary
 
Fields inherited from class javax.faces.view.facelets.TagHandler
nextHandler, tag, tagId
 
Constructor Summary
IgnoreValidationFailed(javax.faces.view.facelets.TagConfig config)
          The tag constructor.
 
Method Summary
 void apply(javax.faces.view.facelets.FaceletContext context, javax.faces.component.UIComponent parent)
          This will create a PhaseListener for the before phase of PhaseId.PROCESS_VALIDATIONS which will in turn check if the parent UICommand component has been invoked during the postback and if so, then set a context attribute which informs the Form to ignore the validation.
 
Methods inherited from class javax.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IgnoreValidationFailed

public IgnoreValidationFailed(javax.faces.view.facelets.TagConfig config)
The tag constructor.

Parameters:
config - The tag config.
Method Detail

apply

public void apply(javax.faces.view.facelets.FaceletContext context,
                  javax.faces.component.UIComponent parent)
           throws java.io.IOException
This will create a PhaseListener for the before phase of PhaseId.PROCESS_VALIDATIONS which will in turn check if the parent UICommand component has been invoked during the postback and if so, then set a context attribute which informs the Form to ignore the validation.

Throws:
java.io.IOException