Primefaces 5.2 inputNumber does not send the updated value to the Bean

Asked

Viewed 239 times

0

When the submit of form occurs through the enter, being focused on inputNumber and changing its content, this new value does not update the variable in the Bean.
However, if the submit occurs by clicking the button, the value is sent to Bean correctly.

<h:form id="meuForm">
...
    <pe:inputNumber id="categoria" value="#{bean.categoria}" decimalPlaces="0" required="true" requiredMessage="..." disabled="#{bean.categoriaDisabled}" emptyValue="empty" autocomplete="off">
        <f:validateLongRange minimum="1"/>
        <p:ajax listener="#{bean.categoriaChange}" update="valor"/>
    </pe:inputNumber>
...
    <p:commandButton id="btnSalvar" value="Salvar" actionListener="#{bean.salvar}" update="@form,:growl"/>
...
    <p:defaultCommand target="btnSalvar"/>
...
</h:form>

Provisionally, I’m taking the value this way on Bean:

public void salvar() {
    String cat = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("meuForm:categoria_input");
    ...
}  

Any idea how to solve this problem?

1 answer

0

Already tried to set the processing scope of p:commandButton?

process="@form" or process=":meuForm"

And maybe use a ajax="false".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.