+ Start a Discussion
Vivek ViswanathVivek Viswanath 

Invoking action function from Javascript

  HI

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"/>
TLFTLF

Hi. This looks correct to me. I too am having some problems getting actionFunction to work for me. See this thread: http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=4075&jump=true#M4075

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.
ravi1.388133693242557E12ravi1.388133693242557E12
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;
      }else{
          activateInterface();
          return false;
          }
      });