RowEdit retains the old value entered and doesnt update the value to null

174 Views Asked by At

I have a html text box Account Number and I am trying to update the value of the textbox to null and it doesn't allow it to be updated to null, the call is made through ajax. I have a similar textbox fee type on the same page and that works just fine. Both the columns are nullable in database. When I check in debug mode the Account number never shows as null, instead displays the previous value retained in db. OnRowedit method -> event.get object() always has the previous value. I saw few other links where it was mentioned init() is required and I do have that in my bean class. Please assist. Any pointers are greatly appreciated.

Below is my xhtml:

<p:column headerText="Account Number" width="65">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{record.acctNbr}" />
                    </f:facet>
                    <f:facet name="input">
                        <h:inputText id="formAcctNbr" label="Account Number"
                            value="#{record.acctNbr}" maxlength="6"
                            validatorMessage="Account Number is Numeric of lenghth '6'">
                            <f:validateLength minimum="6" maximum="6" />
                            <f:validateRegex pattern="[0-9]*" />
                        </h:inputText>
                        <h:message for="formAcctNbr" style="color:red" />
                    </f:facet>
                </p:cellEditor>
            </p:column>



<p:column headerText="Fee Type" width="60">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{record.feeType}" />
                    </f:facet>
                    <f:facet name="input">
                        <h:inputText id="formFeeType" label="Fee Type" 
                            value="#{record.feeType}" maxlength="5"
                            validatorMessage="Fee Type is Numeric between 1 and 32767">
                            <f:validateLongRange minimum="1" maximum="32767" />                         
                        </h:inputText>
                        <h:message for="formFeeType" style="color:red" />
                    </f:facet>
                </p:cellEditor>
            </p:column>

Below is my javaBean:

public class AcctRefTo implements Serializable {

 private Short feeType;
 private String acctNbr;

public Short getFeeType() {
        return feeType;
    }

    public void setFeeType(Short feeType) {
        this.feeType = feeType;
    }
public String getAcctNbr() {
        return acctNbr;
    }

public void setAcctNbr(String acctNbr) {
        if (acctNbr!= null) {
            this.acctNbr= acctNbr.trim();
        }
    }
}
0

There are 0 best solutions below