4 Replies Latest reply on Jul 16, 2010 8:08 PM by Chuanbao Lu

    a4j support validation for empty numeric input box

    Chuanbao Lu Newbie

      Hi, I have a piece of code as below. The problem is, when I load a record with value in this field, let's say 1000.00, I hit delete or backspace key, and delete all the number in the field, the field is empty. But once I move the focus out from this input box, the value 1000.00 comes back again. Other string type of fields work different from number fields. I delete the content, move focus out, the input box is still empty. Anybody knows why? Thanks.

       

      <s:decorate id="capitalGainsField" template="layout/edit.xhtml">
           <ui:define name="label">Capital Gains Amount</ui:define>
           <h:inputText id="capitalGains" maxlength="10" value="#{t3SlipHome.instance.capitalGains}">
                 <a:support event="onblur" reRender="capitalGainsField" bypassUpdates="true" ajaxSingle="true" />
           </h:inputText>
      </s:decorate>
      
      
         @Digits(integerDigits=7, fractionalDigits=2)
          @Column(name="CAP_GAINS_AMT", precision=9)
          public BigDecimal getCapitalGains() {
              return this.capitalGains;
          }
          
          public void setCapitalGains(BigDecimal capGainsAmt) {
              this.capitalGains = capGainsAmt;
          }