2015-01-08 2 views
0

이 문제가 발생하여 여기에서 Google의 일부 페이지와 페이지를 검색하고 답을 얻지 못했습니다.p : p : dialog 내의 commandButton이 작동하지 않습니다.

나는 다음과 같은 대화 상자가 :

<!-- 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> 

을 그리고 난 내의 MBean에서 다음과 같은 방법이 있습니다

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

내가 이미 mbeanActionEvent을 제거 시도했지만 아무것도 작동하는 것 같다 없습니다.

+1

http://stackoverflow.com/questions/2118656/commandlink-commandbutton-ajax-backing-bean-action-listener-method-not-invoked/2120183을 모두 제외 시켰습니까? – BalusC

+0

문제는 유효성 검사 오류입니다. 어떤 이유로 PF 확장의 inputNumber가 붙여 넣기 값이나 필드의 자동 채우기의 다른 형식을 허용하지 않습니다. –

답변

0

문제가 유효성 검사 오류입니다. 어떤 이유로 PF 확장의 inputNumber가 붙여 넣기 값이나 필드의 자동 채우기의 다른 형식을 허용하지 않습니다.

0

이유는 단순히

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

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

쓰기?

+0

'actionListener' 만'action'으로 변경하는 것은 기본적으로'actionListener' 자체가 이미 실패 할 경우 도움이되지 않습니다. 게다가, 묘사 된 시나리오에 기반 해,'actionListener'는 기본적으로 더 적합합니다. 왜냐하면이 메소드는 아무것도 반환하지 않기 때문에 ('void') - 단지 포스트 백을 수행하기 때문입니다. – Tiny

관련 문제