2 Replies Latest reply on Aug 8, 2012 10:41 AM by Patrick Garner

    Richfaces rich:validator not marking UIInput invalid during client-side validation

    Patrick Garner Newbie

      I'm using rich:validator for JSR-303 validation on an inputText as follows:


      <h:outputLabel value="#{msgs['label.email']}:"/>
      <h:inputText value="#{loginBean.email}" id="email" validatorMessage="Invalid email address." styleClass="#{component.valid ? '' : 'invalid'}">
          <rich:validator />
      <rich:message for="email" />


      When validation fails the class of the inputText is supposed to change to invalid, which causes a red border around the component to appear, and the rich:message is supposed to display the Invalid email address message.


      If I enter an invalid email address and move the mouse cursor outside of the inputText only the Invalid email address message appears; the UIInput does not switch to the invalid class, so no red border appears around the component.


      However, if I click the submit button and submit the form with an invalid email address, when the page is reloaded the inputText box's class changes and I get both the red-bordered component as well as the error message.


      Why is this so?  Doesn't JSR-303 require that client-side validation work just the same as if the form were to be submitted?