1

I have a commandbutton that inserts data into database. I want to change button label after I click it and then it will be disabled.

How can I do it?

tgcndr
  • 15
  • 7

1 Answers1

1

Try with a boolean value in your baking bean

in your bean

boolean buttonDisabled = false;

.xhtml

<p:commandButton "#{yourBean.buttonDisabled ? 'old label' : 'new label'}" disabled="#{yourBean.buttonDisabled}">
     <f:setPropertyActionListener value="true"
         target="#{yourBean.buttonDisabled}" />
</p:commandButton>
David Florez
  • 1,460
  • 2
  • 13
  • 26