1
Can anyone tell me how to change the message of <p:confirm>? When you click the button I want the value of message is returned by the method messageCount().
...
<p:outputLabel value="Teste:" />
<p:inputText value="#{testeController.campoTeste}" id="campoTeste"/>
...
<p:commandButton value="Ok" action="#{testeController.cadastrarTest()}">
<p:confirm header="Confirmação" message="Confirmar?"/>
</p:commandButton>
...
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
<p:commandButton value="Sim" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="Não" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
...
public Integer messageCount() {
return count++;
}
Right... But I think this is the problem. I need to use a message that will vary depending on the click on the button. In this example you gave me will always be the value set at the beginning. How can I change the value of
String messageevery click?– Mamga
I’ll edit the answer
– Pedro Laini
But the
actionwill be executed only after I acceptp:confirmDialog. Isn’t it? If so, I need to change the message before I give the Submit in the form. Thank you– Mamga
When do you want to change the message??? From what I understand.. every time you click the button would change the message.... as you want then ?
– Pedro Laini
Let’s see if I can explain myself better now... In the example I posted has the button OK, when I click on it is shown
p:confirmmessage with the options Yes and Not. When I click on Yes executesaction="#{testeController.cadastrarTest()}". Well that’s the normal way it works. What I need, considering what I described, is that by clicking the button OK before executing thecadastrarTest()I can go to the controller and get the updated text to use on the Confirmation. Thank you– Mamga
I’ll edit the answer then
– Pedro Laini
Perfect... now ok... I will "work" on
getMessage(). Thank you very much...– Mamga