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 

Issue with Action Support in IE

The following code works for Firefox and shows the total however it fails for IE . I am trying to execute the Action support on the Change event of the Apex table. I tried moving the action support to inside the column tag however it then works only for the first row but dose not work for Firefox. Please let me know if there is anything I am doing wrong here. The code here works for Firefox.

<apex:page id="Test_Action_Support" controller="Test_Action_Support_Controller" action="{!init}" rendered="true" >

<apex:outputPanel >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable width="550" value="{!accts}" var="itemsToOrder">
            <apex:actionSupport event="onchange" action="{!calTotalHistoricalRevenue}"rerender="tableTotal" />
                <apex:column headerValue="Item Listed">
                    <apex:inputfield value="{!itemsToOrder.HS_Total_Available_Heart_Smart_Points__c}"/>
                    <apex:facet name="footer">
                    Total Cost of Reg Kit Items:
                    </apex:facet>
                </apex:column>
                <apex:column headerValue="Quantity">
                 
                        <apex:facet name="footer">
                        <apex:outputPanel id="tableTotal">
                        <apex:outputText value="{!totalHistoricalRevenue}"></apex:outputText>
                        </apex:outputPanel>
                    </apex:facet>
                </apex:column>

       
            </apex:pageBlockTable>

                </apex:pageBlock>
    </apex:form >
    </apex:outputPanel>
</apex:page>

public class Test_Action_Support_Controller
{

public List <Account> accts= new List <Account>();
public Double totalHistoricalRevenue = 0;
    
    public List <Account> getaccts()
    {
        return accts;
    }
    public Double gettotalHistoricalRevenue()
    {
        return totalHistoricalRevenue;
    }
    // init function that gets the accounts
    public void init()
    {
        accts = [select HS_Total_Available_Heart_Smart_Points__c from Account limit 10];
    }
    
    // THis is the function to calculate the total to be called by the action support
    public PageReference calTotalHistoricalRevenue()
    {
        for (account acct : accts)
        {
            if(acct.HS_Total_Available_Heart_Smart_Points__c!=null)
            {
                totalHistoricalRevenue = totalHistoricalRevenue + acct.HS_Total_Available_Heart_Smart_Points__c;
            }
        }      
        return null;
    }

}
jwetzlerjwetzler
Whenever you use actionSupport you should think of it as putting that javascript event on the parent.  pageBlockTable is just a representation of a table tag in HTML (although with iteration, CSS, header generation, etc.).  As far as I know <table> does not support the onchange attribute, which means that your code is not going to work.  If it works in Firefox it's probably because Firefox is much more forgiving (and a little bit smarter) about trying to handle your javascript, which we have seen before when people misplace their actionSupport tags.  I think you're going to have to try a different approach.
Vivek ViswanathVivek Viswanath
Input field dose have onChange however it dosent work any suggestions on how to implement this would be great.
jwetzlerjwetzler
I know inputField has onchange, and actionSupport absolutely does work with inputField (for most data types).

What I said is that table does not support actionSupport, and since your actionSupport is a child of pageBlockTable, this is not going to work.  It's a fluke that it works with Firefox.

If you want to leverage the onchange event for an inputField, you have to make it a child of inputField.  If it's not working with iteration then maybe you should be looking at leveraging actionFunction with the onRow* attributes of pageBlockTable.