0 Replies Latest reply on Dec 16, 2011 10:56 AM by J S

    rich:ajaxValidator doing nothing

    J S Newbie

      Hi

       

      I'm trying to follow the livedemo example to make an ajax validation inputText:

       

      <h:inputText id="age" value="#{myBean.age}">

         <f:validateLongRange minimum="18" maximum="99"/>

         <rich:ajaxValidator event="onblur"/>

      </h:inputText>

       

      I insert "999" in the text field, press the mouse away to remove focus and expect to see a validation error, but nothing happens.

      Substituting the ajaxValidator tag with

      <a4j:support ajaxSingle="true" event="onblur" reRender="it" bypassUpdates="true"/>

      also does nothing.

       

       

      I also tried addying a ajaxListener property to the ajaxValidator and it correctly calls the bean method, from there I tried to do

       

      FacesContext context = FacesContext.getCurrentInstance();

      HtmlInputText htmlInputText = (HtmlInputText) ((HtmlAjaxValidator) e.getSource()).getParent();

      htmlInputText.validate(context);

      boolean valid = htmlInputText.isValid();


      valid contains the correct value but I don't know what to do to make the error message appear (throwing a ValidatorException did nothing) and I expected to make the error message appear without touching the backing bean anyway.

       

      Any idea what could be the cause?

       

      Thanks