[SalesForce] How to stop refreshing the VF page

I created a Vf page to show Account lookup and Picklist option. When An account is choosen the Picklist will render the values.

Once I select the picklist value it is refreshing the entire VF page
How to stop this can anyone please help me ?

Page :

    <apex:inputField value="{!object__c.AccountId}">
        <apex:actionSupport event="onchange" action="{!method1}"
            rerender="op1">
            <apex:param assignTo="{!acclookup}" value="{!object__c.AccountId}" />
        </apex:actionSupport>

    </apex:inputField>   
<apex:OutputPanel Id="op1">
                 Picklist
                    <apex:selectList value="{!pick}" multiselect="false"
        size="1">
        <apex:selectOptions value="{!options}" />
        <apex:actionsupport event="onchange">
            <apex:param assignTo="{!object__c.Picklist__C}" value="{!pick}" />
        </apex:actionsupport>
    </apex:selectList>

Best Answer

You need to add rerender to appropriate component in your second actionSupport inside selectList to avoid refresh of whole page, if it is required.

Rerender: The ID of one or more components that are redrawn when the result of an AJAX update request returns to the client. This value can be a single ID, a comma-separated list of IDs, or a merge field expression for a list or collection of IDs. Without it whole page would refresh.

Related Topic