I have a p:command button as shown below.
<p:commandButton id="settings" ajax="false" onComplete="window.alert('sometext');" value="#{messages.settings}"
styleClass="cancelButton" style="font-family: sans-serif, Arial, Helvetica, Geneva; font-size: 10pt; width: 90px;" /></td>
I want this button to run a java-script onComplete or onClick but I can not get any of them to work. I actually want it to open a popup but here I have tried with an easier script to just do an alert. But this does not work either. Nothing happens at all.
Can anyone help me?
First : there is no capitals in
onxxx(where xxx is start / complete / success)Since you set
ajax="false"your button won’t do any ajax , which means thatonstart/oncomplete/onsuccesswon’t be triggered at allUse
onclick="alert('wow')"If you will remove the
ajax="false"you will be able to useoncomplete="alert('wow')"