4 Replies Latest reply on Jul 22, 2009 4:36 PM by Coral Featherstone

    validating that at least one of n fields are not null on submission of form

    Arbi Sookazian Master

      So I have a functional requirement as follows:

      There are four fields in a HtmlForm in my xhtml page.  One is always required.  Of the other three, one is always required as well (doesn't matter which one).  So basically two fields total must be non-null upon submission of the form.

      I started writing a custom Seam validator class that implements javax.faces.validator.Validator interface but I'm not sure that's the best approach.

      I'm also considering simply evaluating the context variables in my SFSB in the action method for the form submission and adding a message to the facesMessages instance if all of the three fields are null.

      Any tips on this?  thx.