OmniFaces 4.1 has been released!
Nothing shocking. Just one new tag attribute and a bunch of improvements/fixes as compared to 4.0. As usual all these improvements/fixes have been backported into 3.14.2 / 2.7.22.
You can find the complete list of additions, changes and fixes at What's new in OmniFaces 4.1? list in showcase.
Readonly hidden input
The new tag attribute is the <o:inputHidden readonly="true">
. In standard Faces <h:inputHidden>
this attribute is unspecified. In OmniFaces <o:inputHidden>
this attribute is entirely server side. It will basically ignore the submitted value and grab the model value instead for validation. This can be very useful in cases when you intend to block the form submit via a validator attached to the <o:inputHidden>
which validates the model value.
Below is an illustrative example:
<h:selectOneMenu binding="#{paymentMethod}" value="#{bean.paymentMethod}">
<f:selectItem itemValue="bank" itemLabel="Bank" />
<f:selectItem itemValue="card" itemLabel="Credit Card" />
<f:selectItem itemValue="paypal" itemLabel="PayPal" />
</h:selectOneMenu>
<o:inputHidden value="#{bean.bankAccount.id}"
readonly="true"
required="#{param[paymentMethod.clientId] eq 'bank'}"
requiredMessage="In order to pay with bank you need to create a valid bank account first" />
This removes the need to create a custom validator for such case or to awkwardly implement it in the action method.
Installation
Non-Maven users: download OmniFaces 4.1 JAR and drop it in /WEB-INF/lib
the usual way, replacing the older version if any.
Maven users: use <version>4.1</version>
.
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>4.1</version>
</dependency>
How about OmniFaces 3.x, 2.x and 1.1x?
OmniFaces 3.x got the same bugfixes as 4.1 and has been released as 3.14.2. This version is for JSF 2.3 users with CDI. In case you've already migrated to Faces 3.0 or 4.0, please use OmniFaces 4.x instead. OmniFaces 2.x got the same bugfixes as well and has been released as 2.7.22. This version is for JSF 2.2 users with CDI. In case you've already migrated to JSF 2.3, please use OmniFaces 3.x instead.
The 1.1x is basically already since 2.5 in maintenance mode. I.e. only critical bugfix versions will be released. It's currently still at 1.14.1 (May 2017), basically featuring the same features as OmniFaces 2.4, but without any JSF 2.2 and CDI things and therefore compatible with CDI-less JSF 2.0/2.1.