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
Niraj Kumar 9Niraj Kumar 9 

on My page there is a picklist value , If i change the picklist field value from A to B , It should show the popup message

Hi,

on my VF page ther is a picklist field country, If I want to change the saved Country INDIA to USA, After changing the picklist value it should show the Pop up message on ONCHANGE EVENT.



 
Pankaj_GanwaniPankaj_Ganwani
Hi Niraj,

You can store the previous value in span tag and set its visibility to false. Just try with below mentioned code:

<apex:selectList value="{!somevalue}" onchange = "showPopUp(this);"/>
<span id="previousValue" style="display:none;">{!somevalue}</span>
function showPopUp(obj)
{
    if(document.getElementById('previousValue').innerHTML== 'A' && obj.value == 'B')
         alert('message');
    else
    {
          document.getElementById('previousValue').innerHTML=this.value;
    }
}