function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Neil KimNeil Kim 

Actionfunction onComplete works abnormally.

Hi all.
Please help about the issue.
I have onComplete on actionfunction called by button, and called function is another actionfunction that return PageReference for moving to next page.

When I click button at the first it doesn't move to next page, after then, I click it again, it works, moving to next Page.
Why is this happening? Code below.
 
<apex:form>

<Button class="col-mx-6  col-md-6" onclick="moveT()">Go to Next Page</Button>

<apex:actionFunction name="movemove" action="{!saveParams}" reRender="panel" oncomplete="moveToNext()">
    <apex:param name="Param1" assignTo="{!Param1}" value=""/>
    <apex:param name="Param2" assignTo="{!Param2}" value=""/>
    <apex:param name="Param3" assignTo="{!Param3}" value=""/>
    <apex:param name="Param4" assignTo="{!Param4}" value=""/>
</apex:actionFunction>
<apex:actionFunction name="moveToPrevious" action="{!moveTo0}"/>
<apex:actionFunction name="moveToNext" action="{!moveTo2}"/>

</apex:form>




public void saveParams(){
    // some data modification
    // No Page related action.
}

public PageReference moveTo2(){
        PageReference pg;
        pg = Page.VFPage2;

        return pg;
}
Thanks in advance!
 
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Neil

You have 
<Button class="col-mx-6  col-md-6" onclick="moveT()">Go to Next Page</Button>

wherein the moveT() js function is missing. Can you share the JS snippet.

Cheers!!