[SalesForce] Action method is not invoked

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

<script>
   function test() {
       alert("Alert msg "); 
  }
</script>

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

controller

     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;
 }

Best Answer

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