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
Varun AnnadataVarun Annadata 

Alert Message when a wrong picklist is selected

My Vf Page:

<apex:page standardcontroller="Program_Member_MVN__c" extensions="ProgramMemberCaseAttachment" showHeader="false" >
<head>
        <apex:includescript value="//code.jquery.com/jquery-1.11.1.min.js" / >
        <apex:includescript value="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js" />
        <apex:stylesheet value="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css" />
        <script>
            j$ = jQuery.noConflict();
            j$(document).ready( function () {
                var contactTable = j$('[id$="accounttable"]').DataTable({
                    
                });
            });
            
            function Callmefunc()
               {
                  var error='{!AttType}';
                  
                  if({error == 'None') {
                  
                  alert("Please select a Type");
                  
                  }
                }
                
               
    
        </script>
            
</head>
            <apex:form >
            
            <apex:pageBlock id="newPageBlock">
            
            <apex:pageBlockSection columns="3">
            
            <apex:outputLabel ></apex:outputLabel>
          
            <apex:outputLabel style="font-weight:bold"><p1>Input Type:::::</p1>
                        
            <apex:selectList id="DateRange" value="{!AttType}" size="0"  style="background-color:{!(IF(AttType!=null,'red','white'))}">
                            <apex:actionSupport event="onchange" action="{!processSelected1}"/>
                            <apex:selectOption itemValue="None" itemLabel="None"/>
                            <apex:selectOption itemValue="Type1" itemLabel="Type1"/>
                            <apex:selectOption itemValue="Type2" itemLabel="Type2"/>
                            <apex:selectOption itemValue="Type3" itemLabel="Type3"/>
                        </apex:selectList>
                        
                        </apex:outputLabel>
            
            </apex:pageBlockSection>
          
            <apex:pageBlockTable id="accounttable" value="{!PMresults}" var="N" columnClasses="display">
            
            <apex:column headerValue="Save">
            
            <apex:commandLink value="Save" action="{!processSelected}" oncomplete="window.location.href='/apex/ProgramMemberCaseAttachment?id={!Program_Member_MVN__c.id}'; return false" onclick="Callmefunc();">
                        
            <apex:param name="{!N.Attachment_Id__c}" value="{!N.Attachment_Id__c}" assignTo="{!Attid}"/>

            </apex:commandLink>
            
            </apex:column>
            
            <!--<apex:column headerValue="Attachment Name">
            
            <apex:outputField value="{!N.Attachment_Name__c}"/>     
                  
            </apex:column>-->
            
            <apex:column headerValue="Attachment">
            
            <apex:outputField value="{!N.Attachment__c}"/>      
                  
            </apex:column>
            
            <apex:column headerValue="Type">
            
            <apex:outputField value="{!N.Type__c}"/>      
                  
            </apex:column>
            
            <apex:column headerValue="Pm Number">
            
            <apex:outputLink value="/{!N.Program_Member_Lookup__c}" target="_blank">{!N.Program_Member_Lookup__r.Name}</apex:outputLink>     
                  
            </apex:column>
            
            <apex:column headerValue="Case Number">
            
            <apex:outputLink value="/{!N.Case_Lookup__c}" target="_blank">{!N.Case_Lookup__r.Casenumber}</apex:outputLink>     
                  
            </apex:column>
            
            <!--<apex:column headerValue="Name">
            
            <apex:outputLink value="/{!N.Id}" target="_blank">{!N.Name}</apex:outputLink>
            
            </apex:column>-->
            
            <apex:column headerValue="Description">
            
            <apex:outputField value="{!N.Attachment_Description__c}"/>    
                  
            </apex:column>
                  
            </apex:pageBlockTable>
      
            </apex:pageBlock>
            
            </apex:form>
</apex:page>

I am trying to display alert message when "None" picklist is selected but i am not getting the alert message.Where am i going wrong?
Best Answer chosen by Varun Annadata
NagendraNagendra (Salesforce Developers) 
Hi Varun,

Please find the below link from the stack exchange community and tweak it as per your requirement which should help you further with the above requirement. Please let us know if this helps.

Mark this as solved if it's resolved.

Thanks,
Nagendra