I am calling javascript function from apex:inputfield and also doing rerendering page same block section Item using action support as I am using depended picklist on my Visual Force page.

but after adding this

 <apex:actionSupport event="onchange" reRender="pbsiType" /> 

it has stopped calling my javascript function on change of value event.

Below is the code I am using fro Page block section item

<apex:pageBlockSectionItem Id="pbsiType">
                     <apex:outputLabel value="Type"/>

                        <apex:inputField value="{!opp.Type__c}" id="OppType" onchange="Type('{!$Component.OppType}');">
                             <apex:actionSupport event="onchange" reRender="pbsiType" />


and here is the javascript function I am calling from within.

function Type(Receivetype){
        SelectedType = document.getElementById(Receivetype).value;

1 Answer 1


Change your ActionSupport to:

<apex:actionSupport event="onchange" onsubmit="Type('{!$Component.OppType}');" reRender="pbsiType" /> 

and remove the onchange event from the element

  • I cant have that on submit as that also require on onchange event
    – Ricky
    Nov 19, 2015 at 20:41
  • Ricky, onsubmit will not launch on submit of the form, it will do onsubmit of the "actionsupport". This means that your JS code will run, and then the re-render is going to happen Nov 19, 2015 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .