+ Start a Discussion
Dhananjaya BulugahamulleDhananjaya Bulugahamulle 

How to give a alert when we select a specific value from pick list?

User-added image
I have a pick list called System Size(System_Size_SUB_2013__c). When I select 2000L SUB from pick list, I want to give an alert to the user. (Only for a 2000L SUB, Not all of them). Any idea how to do that? Thanks

<apex:inputField value="{!Product_Brief__c.System_Size_SUB_2013__c}" required="true"/>

Pramodh KumarPramodh Kumar
this can be done using the javascript. We can write in many different ways for this like onchange event or write function if it is equal to the 2000L SUB then through the alert message.
Ajay K DubediAjay K Dubedi
Try something like this
<apex:page standardController="Account">
<apex:form >
<apex:inputField value="{!Account.Ownership}" onchange="alert(1);">

Select it as best if it helped you.
Biswa RayBiswa Ray
Hi Dhananjaya,

You can achieve it by invoking a simple JavaScript function on "OnChange" event of Picklist field. 

Code Example,

<apex:page standardController="Account">    
    <script type="text/javascript">        
        function showAccountType(value){          
             alert(value);  //should get the passed value in a alert here.  
    <apex:form id="form1">
        <apex:pageBlock id="pgid">
            <apex:inputField id= "typeId" value="{!account.type}" onchange="showAccountType(this.value);"/>            

Hope it helps.

Dhananjaya BulugahamulleDhananjaya Bulugahamulle
Thanks Guys