0
votes

I have this problem and I search here and some pages on Google and none of the answers worked for me.

I have the following dialog:

<!-- Dialog Fechar Pedido -->
<p:dialog header="Fechar Pedido" widgetVar="clsPedido" id="clsPedido" minWidth="550">
    <h:form prependId="true" id="frmClsPedido">
        <p:panel id="pnlDialogClsPedido" header="Informe a forma de pagamento">
        <h:panelGrid id="grdClsPedido" columns="2" cellpadding="5">
            <p:outputLabel value="Valor Total:." />
            <p:outputLabel value="R$ #{pedidoMB.totalPedido}"  size="5" style="color: red;">
                <f:convertNumber currencySymbol="R$" integerOnly="true" pattern="#0.00" locale="pt_BR" minFractionDigits="1" minIntegerDigits="1" />
            </p:outputLabel>

            <p:outputLabel value="Valor Recebido:." />
            <pe:inputNumber id="vlrRecebido" value="#{pedidoMB.vlrRecebido}" minValue="0" required="true" onblur="returnValue(this.value)" requiredMessage="Informe o valor recebido!" decimalPlaces="2" decimalSeparator="," thousandSeparator="." />

            <p:outputLabel value="Pagamento em:." />
            <p:selectOneRadio id="frmPagamento" value="#{pedidoMB.frmPagamento}" onchange="daTroco(this.value);" required="true" requiredMessage="Informe a forma de pagamento!">
                <f:selectItem itemLabel="Dinheiro" itemValue="DIN" />
                <f:selectItem itemLabel="Débito" itemValue="DEB" />
                <f:selectItem itemLabel="Crédito" itemValue="CRED" />
                <f:selectItem itemLabel="Vale Refeição" itemValue="REF" />
            </p:selectOneRadio>

            <p:outputLabel value="Valor Troco:." />
            <p:inputText value="#{pedidoMB.vlrTroco}" size="5" style="color: blue;" id="vlrTroco" widgetVar="vlrTroco" readonly="true">
                <f:convertNumber currencySymbol="R$" integerOnly="true" pattern="#0.00" locale="pt_BR" minFractionDigits="1" minIntegerDigits="1" />
            </p:inputText>
        </h:panelGrid>

        <h:messages></h:messages>
        <div align="right">
            <p:commandButton icon="ui-icon-disk" actionListener="#{pedidoMB.doFecharPedido}" />
        </div>
        </p:panel>
    </h:form>
</p:dialog>

And I have the following method at my mbean:

public void doFecharPedido(ActionEvent event) {
    if (getId() != null) {
        Pedido p = getService().findById(getId());
        getService().fecharPedido(getVlrRecebido(), getVlrTroco(), p);
    }
}

I already tried removing the mbean ActionEvent but nothing seems to work.

2
Have you excluded all of stackoverflow.com/questions/2118656/…?BalusC
The problem was a validation error. For some reason the inputNumber from PF extension does not accept a paste value or some other form of automatic fill of the field.Eduardo Santos

2 Answers

0
votes

Why not simply write

<p:commandButton icon="ui-icon-disk" action="#{pedidoMB.doFecharPedido}" />

and

public void doFecharPedido() {
    if(getId() != null) {
        Pedido p = getService().findById(getId());
        getService().fecharPedido(getVlrRecebido(), getVlrTroco(), p);
    }
}

?

0
votes

The problem was a validation error. For some reason the inputNumber from PF extension does not accept a paste value or some other form of automatic fill of the field.