My JSF Books/Videos My JSF Tutorials OmniFaces/JSF PPTs
JSF 2.3 Tutorial
JSF Caching Tutorial
JSF Navigation Tutorial
JSF Scopes Tutorial
JSF Page Author Beginner's Guide
OmniFaces 2.3 Tutorial Examples
OmniFaces 2.2 Tutorial Examples
JSF Events Tutorial
OmniFaces Callbacks Usages
JSF State Tutorial
JSF and Design Patterns
JSF 2.3 New Features (2.3-m04)
Introduction to OmniFaces
25+ Reasons to use OmniFaces in JSF
OmniFaces Validators
OmniFaces Converters
JSF Design Patterns
Mastering OmniFaces
Reusable and less-verbose JSF code

My JSF Resources ...

Java EE Guardian
Member of JCG Program
Member MVB DZone
Blog curated on ZEEF
OmniFaces is an utility library for JSF, including PrimeFaces, RichFaces, ICEfaces ...

.

.

.

.

.

.

.

.


[OmniFaces Utilities] - Find the right JSF OmniFaces 2 utilities methods/functions

Search on blog

Petition by Java EE Guardians

Twitter

vineri, 8 aprilie 2016

Entirely skip validation via SkipValidators

OmniFaces 2.3 comes with a new tag handler named SkipValidators. As its name suggest, this tag handler allows us to entirely skip validation when executing an UICommand or ClientBehaviorHolder action. Simply place the <o:skipValidators/> tag inside a UICommand or ClientBehaviorHolder component. For example, in the below code, the button labeled Hard Submit will take validation into account, while the button labeled Soft Submit will entirely skip validation and the submitted data end up in the data model:

<h:form>
 <h:messages/>
 <h:panelGrid columns="2">
  <h:outputLabel for="nameId" value="Name:"/>
  <h:inputText id="nameId" value="#{dataBean.name}" required="true"/>
  <h:outputLabel for="emailId" value="E-mail:"/>
  <h:inputText id="emailId" value="#{dataBean.email}" required="true" validator="emailValidator"/>
  <h:commandButton value="Hard Submit"/>
  <h:commandButton value="Soft Submit">
   <o:skipValidators />
  </h:commandButton>
 </h:panelGrid>
 Name: #{dataBean.name} | E-mail: #{dataBean.email}
</h:form>

Note Even if the validation is disabled conversion errors could still occur.

This can be useful in different scenarios including debugging, testing, dynamically adding/removing items from a form, etc. You can temporary disable the validation for large forms and perform different checks with respect to data model. Instead of removing validators one by one, you simply add this tag handler.  The complete application is available here.

Niciun comentariu :

Trimiteți un comentariu

JSF BOOKS COLLECTION

Postări populare

Visitors Starting 4 September 2015

Locations of Site Visitors