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
Vivek ViswanathVivek Viswanath 

Invoking action function from Javascript


I was trying to call a custom javascript function on click which inturn calls the action function I would like to know if I am doing it right. its not going into my controller function.
This is what I want to do
function save_clicked() // custom function
// logic(this part works)
  saveOrder();// call to the action function

<apex:actionFunction name="saveOrder" action="{!SaveProgramOrderAndItems}" />
       <apex:pageBlockButtons location="bottom">
  <apex:commandButton value="Save and Create Order" onclick="save_clicked"/>

Hi. This looks correct to me. I too am having some problems getting actionFunction to work for me. See this thread:

I still haven't figured out why it's not working. I've used actionFunction successfully elsewhere, but in this case, it isn't working for me.
Hi, I am also facing the same problem..
Amol SolankiAmol Solanki
I tried this and it worked for me.

VF page :
<apex:commandButton value="Activate/Lock" id="activeIA"  styleClass="btn btn-success activeIA "  disabled="{!activeIA}" style="margin-right:10px;" html-data-toggle="tooltip" html-data-placement="bottom" html-data-original-title="Please click activate for activating Integration." />
                        <apex:actionFunction name="activateInterface" action="{!submitActiveIA}"  /> 

Javascript :
 $('body').on('click', '.activeIA', function(e) {
         var r = confirm("Once Interface is activated, you cannot make configuration changes until it is unlocked. Do you like to proceed?");
         if ( r == false){
               return false;
          return false;