Change pattern behavior of element p:confirmDialog

Asked

Viewed 73 times

0

I need to change the default behavior of the p:confirmDialog element. By clicking yes, he must complete the request by passing a value and clicking no, he must complete the request by passing another value.

<p:commandButton value="Consultar"  onclick="consultar.show()">  
    <p:confirmDialog id="consultar" message="Foi feito a venda de recarga para esse cliente?" header="Confirmação" severity="alert" widgetVar="consultar">  
        <p:commandButton id="confirmaBtn" value="Sim" oncomplete="consultar.hide()" action="#{notaFiscalBean.consultarNota}">
            <f:setPropertyActionListener target="#{notaFiscalBean.temRecarga}" value="1" />    
        </p:commandButton>
        <p:commandButton id="recusaBtn" value="Não" oncomplete="consultar.hide()" action="#{notaFiscalBean.consultarNota}">
            <f:setPropertyActionListener target="#{notaFiscalBean.temRecarga}" value="0" />
        </p:commandButton>   
    </p:confirmDialog>
</p:commandButton>  

But this solution is not working. Does anyone have any idea what I can do? Thank you!

  • Add your bean’s action code, too.

1 answer

0


Browser other questions tagged

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