5 Replies Latest reply on Nov 20, 2008 4:28 PM by Franco Fernandes

    force a4j:support onchange for field value from browser hist

    Franco Fernandes Novice

      Seam 2.0.2 and Richfaces 3.2.1

      I don't understand how to correctly trap this validation.

      I have this field

      <s:decorate id="taxCodeDecoration">
       <h:inputText id="taxCode"
       required="true"
       label="Tax code"
       size="10"
       disabled="#{taxHome.managed}"
       maxlength="10"
       styleClass="#{invalid?'errors':''}"
       value="#{taxHome.instance.taxCode}">
       <a4j:support event="onblur" reRender="taxCodeDecoration" ajaxSingle="true" bypassUpdates="true" />
       <a4j:support event="onchange" reRender="taxCodeDecoration" ajaxSingle="true"
       action="#{taxHome.validateTaxCode}"/>
      
       </h:inputText>
      </s:decorate>


      and this action method

      public void validateTaxCode() {
      
       isUniqueSimpleKey(
       getInstance().getClass().getName(),
       "taxCode",
       getInstance().getTaxCode(),
       "This tax code already exists" ) ;
      
       }



      This is the key field for my entity and my validation is checking if the field value is unique.

      If I pick a value from the drop down list of previously entered values (from the browser's autocomplete history), the validation fires the first time and I get the error message, but then thereafter if I type the same value, onchange is not fired. I understand that. What JS event should I use to trap this validation?

      Thanks
      Franco


      I now to try to recreate the same