I am trying to get the total of 5 inputfields onchange. I am using apex:actionFunction but i am not able to call the action method on apex:actionFunction. I have a inputtext which is calling the actionfunction on change and the action function is reRender an outputtext. The output text method is invoked bu the actionFunction action method is not invoked. I tested it by adding a alert meg in javascript and on complete of the actionFunction. I am getting the alert meg but not able to call the action method my code :

<apex:actionFunction name="Update"  action="{!totalOut}" oncomplete="test()"  reRender="Exp_total" />

   function test() {
       alert("Alert msg "); 

  <apex:pageblocksectionitem >
  <apex:outputlabel value="" />
  <apex:inputfield id="Con" value="{!exp.Expense_total_inc_taxes__c}" required="true"   onchange="Update()" /> 
 <apex:pageblocksectionitem >
 <apex:outputText value="{!totalIn}"  id="Exp_total" >


     public string totalExp;
 public PageReference totalOut() {
     system.debug('Result : total ' + exp.Expense_total_inc_taxes__c);
     totalExp = string.valueof(exp.Expense_total_inc_taxes__c);
     return null;

 public string totalIn;
 public String getTotalIn() {
     return totalExp;

 public void settotalIn(string totalIn){

     this.totalIn = totalExp;
  • Can you check with Oncomplete? – Mohith Shrivastava Nov 29 '12 at 11:08
  • yes i mentioned in that i have tested the action function with oncomplete. I tested it by using an alert meg. – AnuRaj Nov 29 '12 at 11:12
  • I am stumped !Usually onchange does work for me .And for me this code looks ok . – Mohith Shrivastava Nov 29 '12 at 11:16
  • One more stuff will be to use Onblur and try. – Mohith Shrivastava Nov 29 '12 at 11:16
  • you have asked me to use onblur in the place of onchange in inputtext. I tried it but no change. the method is not at all invoked. – AnuRaj Nov 29 '12 at 11:27

In my experience this usually means I've encountered an error and swallowed it. Do you have multiple required fields or validation rules that could error and stop the action method being invoked?

The way I find out is to add an apex:pageMessages component to the page and rerender that as part of the actionfunction:

<apex:actionFunction name="Update"  action="{!totalOut}"
        oncomplete="test()"  reRender="Exp_total, msgs" />

and then somewhere down the page:

<apex:pageMessages id="msgs" />
| improve this answer | |
  • Thanks Bob! There was nothing in the apex logs, and nothing in the browser's console. There was no JS issue when debugging - This was the only way to see a hidden required field that was preventing validation. – HungryBeagle May 6 '15 at 13:30

I would do following :

  1. Setup a debug log, check if you are at least hitting the apex controller class.
  2. Use developer console & put break point on the apex controller class, also you can debug VF page in developer console.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.