2 Replies Latest reply on Nov 30, 2009 2:03 PM by Damian Harvey

    Ajax form validation on a modal w-o modal dismissing?

    erik scherer Newbie

      I've looked at a lot of form validation examples on the internet, but none to seem to match the situation I have at hand.  I have a modal dialog with a form in it I want to validate via onchange through Ajax.  I have all the Ajax plumbing working with a valueActionListener, but...  This isn't really what I want.

      The validation I need to do is also a business logic validation (hance the reason I choose the valueActionListener approach) and doesn't fit the Hibernate validations via annotations.  I have two text fields and while either can be blank (so I can't use @NotNull), they can't BOTH be blank.  I could write a custom validator I suppose (I've never done that before), but there is still the issue of the modal dialog dismissing when the Update button is clicked, which we don't want.

      The desired behavior would be:

      (1) Click update and A4J validation takes place (via? I doubt valueActionListener is the way to go?)
      (2) The business logic validation as well as all Hibernate validations take place.
      (3) The modal is NOT dismiss unless all the validations have passed.
      (4) Validations which fail provide a facesMessage to the modal dialog itself (which again, does not dismiss.)

      Any help here would be GREATLY appreciated,