0 Replies Latest reply on Mar 15, 2009 10:14 AM by Louis Parisi

    Help with Ajax Validator requires double submit

    Louis Parisi Newbie

      I am using the rich:ajaxValidator to validate minimum length with event=onBlur to validate a bean field in a form on a rich:modalPanel. I am using the Hibernate Validator to enforce the minimum length. The validation is working properly and gives the message specified if I put a String with fewer than the required characters. This is a Spring Webflow project.

      The scenario for the problem is this:

      The user does an edit so all fields are already populated.
      The user changes the field with min length to an invalid value and then clicks on another field.
      The validation error message is displayed next to the field.
      The user fixes the length error and clicks save.
      The validation error is cleared but the form is not submitted. The user must click Save again for the form to be submitted.


      Here is the code for the save command link:
      <a4j:commandButton value="Save"
       action="#{userDataTable.updateSelectedUser(messageContext)}"
       reRender="displayName, userName, phone"
       oncomplete="if (#{!messageContext.hasErrorMessages()}) #{rich:component('editPanel')}.hide();" />


      Here is the code for the form validation:
      <h:outputLabel class="requiredField" for="editUsername">Username:</h:outputLabel>
       <h:inputText label="Username" id="editUsername"
       value="#{userDataTable.modifiedUser.username}" required="true">
       <rich:ajaxValidator event="onblur"/>
       </h:inputText>
       <rich:message for="editUsername">
       <ui:include src="/WEB-INF/layouts/inputmsgmarker.xhtml"/>
       </rich:message>


      Thanks for any help or insight you can give me on this.