Pass the Picklist value in Javascript Onchange using Visualforce page

Visualforce page use the below codes:

<apex:inputField value=”{!Account.Status}”  onchange=”foo(;” id=”AccStatus”/>

Even better approach will be to send current element to JavaScript function rather than passing only id & then finding same element.

<apex:inputField value=”{!Account.Status}”  onchange=”foo(this);” id=”AccStatus”/>

Javascript Function
function foo(data){
alert(“Call came “);//this is displyed
alert(‘********The field value is ********’+data.value);

Written by 

3x Salesforce MVP | Platform Champion | 18x Salesforce Certified | MuleSoft Certified | 8x Trailhead Ranger | TechForce Services | Sydney | Australia

Leave a Reply

Your email address will not be published.