I have a class called OrderItem which is annotated on its units property with Hibernate Validator as follows:
@Entity @Table(name = "ORDER_ITEM") public class OrderItem { . . . @Column(name = "UNITS", nullable = false) @NotNull @Min(value=1, message = "Need 1 or more units for each item.") public BigInteger getUnits() { return units; } . . . }
Meanwhile, on the front end I have a table of these OrderItems, and the units property is editable in a text box. When the text box is updated, I want either of the following to happen:
Here is the portion of my facelet that describes this:
<rich:column> <th type="text" jsfc="h:inputText" value="#{orderItem.units}" id="unitsBox"> <s:validate/> <a4j:support event="onblur" reRender="unitsBox,orderItemTotal,orderTotal" /> </th> </rich:column>
The totals get updated just fine with a valid value. However, when the value is invalid, nothing happens. Not until I do a conventional submit and return immediately to this page do I see the faces message specified in Hibernate Validator on the OrderItem entity.
How can I get the validation done Ajax-ly along with the totals?
Thanks.