Incomplete PrimeFaces attribute in JSF <h: commandButton>
1 answer
Since oncomplete strings oncomplete equivalent to a simple JSF success event (see the answers to the answer for more details, you should use the success events as follows:
Embedded Solution
<h:commandButton id="someId" action="#{myBean.myAction}"> <f:ajax onevent="function(data) { if (data.status === 'success') { alert('complete'); }" render="whatevet"></f:ajax> </h:commandButton> Another cleaning solution would be to use the js function
<h:commandButton id="someId" action="#{myBean.myAction}"> <f:ajax onevent="myJsFunction" render="whatevet"></f:ajax> </h:commandButton> In your js file add
function myJsFunction(data) { if (data.status === 'success') { alert('complete'); } } In case you are looking for a way to detect non ajax submit termination, you can take the following idea from here. Detecting File Upload Dialog In Browser
The easiest solution is to use
$(document).ready(function () { // check if some condition is meet and do something... }); +10