I have run into an issue with an apex:command button, where the oncomplete part of the process is not being called, and prevents the button from completing its action.
The VF page is a component on a record page, so the refresh is JS to reload the page (not just the component vf page).
The pages class supplies the return URL ({!redirectUrl})
The VF Button
apex:commandButton
value="Reject (Entry Criteria)"
onclick="return confirm('Are you sure?');"
action="{!rejEC}"
oncomplete="refreshPage();"/>
The JS
function refreshPage(){window.top.location.href = '{!redirectUrl}';}
If I use the above setup, the Confirm dialog appears, the action does not fire and the page is not refreshed
If i remove onComplete, the Confirm dialog appears, the action fires successfully, and the page is not refreshed.
If i remove onClick, the Confirm dialog does not appear, the action fires successfully, and the page is refreshed.
So it seems you cant have onClick and onComplete in the same button??
Any thoughts?
Thanks!