I've got the following button:

<apex:commandLink value="Save" action="{!saveDeliveryRow}"  onComplete="saveComplete();"/>   

This calls the following method on the controller :

public PageReference saveDelivery() { 
    upsert RightsTrackerListDelivery;
    return null;

However my problem is, the saveComplete() function in the button's onComplete event isn't fired. I was expecting it to perform the controller action and then afterwards enter the onComplete event.

If I put onComplete="alert('test');" then the alert will pop up before the page redirects. Is there any way to call a function like this?

1 Answer 1


I managed to solve this with the following:

Instead of using action="{!saveDeliveryRow}" in my commandLink/button, I created an action function linking to the method.

I then added the onComplete="saveComplete" event to the action function, and it works as expected.

You must log in to answer this question.