3 Replies Latest reply on Oct 18, 2008 9:17 AM by Ingo Jobling


    Ingo Jobling Master


      I am experiencing some difficulty in finding a suitable approach for form level validations.

      My use case is a DataTable which allows updates as well as addition of a new row (The result set has an additional, new row appended to it)

      I only want the required validations to fire on the new row if the user has filled in at least one value on the row.

      I have tried several approaches:

      1) Calling Hibernate validators from an action.  The problem with this approach is that the input controls in the table are not flagged as invalid - I want to highlight these fields in the usual manner using s:decorate.  The problem is identifying the component's client id (including its row index)

      2) Custom validator in combination with JSF binding offers more control, including flagging the appropriate fields as invalid.  The drawback of this approach is that it requires duplicating (or moving) validations from the JSF page/Hibernate validator into Java code.  We have a lot of pages, and I don't relish the prospect of writing custom validators for each page, for what seems like a relatively simple requirement.

      3) using EL in combination with the required attribute, for example,


        This requires an Ajax call after each field, for example, onblur, with the attendant delay of a server call.

      As Seam in general makes working with JSF easier, it would be great if there was more support for form level validations.  Also, it would be nice if Hibernate validations were called even if the field is not required.  

      Unfortunately, there doesn't seem to anything new in Seam 2.10 regarding validations, AFAIK

      The Myfaces/Shale projects seem to have some interesting initiatives in this area.

      I would appreciate any advice!