2

Can any one tell why I am unable to show an alert message onchange of picklist values in Topic and Subtopic. I am also calling onload controller method in the java script which synchronize Topic and Subtopic.

                        <apex:pageBlockSection columns="1">
                            <apex:pageBlockSectionItem >
                                <apex:outputLabel >Select Topic:</apex:outputLabel>
                                <apex:inputField value="{!dummyCase.Topic__c}" onchange="loadSet();" id="st" />
                            </apex:pageBlockSectionItem>
                        </apex:pageBlockSection>

                        <apex:pageBlockSection columns="1">            
                            <apex:pageBlockSectionItem rendered="{!TopicSelected}">
                                <apex:outputLabel >Subtopic:</apex:outputLabel>
                                <apex:inputField value="{!dummyCase.Subtopic__c}" onchange="loadSet();"/>
                            </apex:pageBlockSectionItem>    
                        </apex:pageBlockSection>

                     <script>
                            function loadSet()
                                {
                                    var myPicklistElement = document.getElementById('{!$Component.frm.st}');
                                    var myPicklistValue = myPicklistElement.options[myPicklistElement.selectedIndex].value;

                                        if (myPicklistValue == 'value1')
                                            {
                                        alert('value 1');

                                       //  return;
                                            }                                               
                                             onload();

                                }
                         </script>  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.