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
san5augsan5aug 

apex:actionFunction not working

I need to use the actionFunction tag to  launch a controller method.
The controller method returns a new page reference. However it seems my controller method is not called...
MIRPriorityDetails is my component with some proprties.

VF:

<apex:page title="CEB - MIR Home Page" standardcontroller="CC__c" extensions="CCController" action="{!MIRContactCreation}">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></apex:includeScript>
<script type="text/javascript">
function saveVertical(e,type){
                window['savepriorityDetail'](<input>);
            }

function resetAction(){}
</script>
<apex:PageBlokButtons>
<input type="button" class="btn mirsave mirbtn" value="Save" onclick="javascript:saveVertical(this,'priorityDetail');"/>
</apex:PageBlokButtons>      
<c:MIRPriorityDetails p="{!priority}" showExtra="{!MIR.hasMainSA}" hidebut="{!isedit}" />
</apex:page>

Component:

<apex:component controller="MIRPriorityDetailController" allowDML="true">
  <apex:actionFunction name="savepriorityDetail" action="{!SavePriority}" oncomplete="resetAction();">
        <apex:param value="aoe" name="aoe" assignTo="{!areasOfExpertise}"/>
    </apex:actionFunction>

</apex:component>

component Controller:
public class MIRPriorityDetailController {

public pageReference SavePriority(){       
        try{
            update sobj;
            PageReference pageRef = new PageReference('/apex/HelloWorld');
      pageRef.setRedirect(true);
      return pageRef;
        }
        catch(Exception excp){

             ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL, 'There are already 5 active priorites and please inactive one to activate the new prority.');
             apexpages.addmessage(myMsg);
        }
        return null;
    }
}
Ashish_SFDCAshish_SFDC
Hi , 


Need some more information on this, 

Did you check if the SavePriority is eing called and executed properly?

What is resetAction() doing?

Did you enable debug logs to see if the logs give any clue?


Regards,
Ashish