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
simhasimha 

Not getting Dependendent Selectedlist

Hello Every body,

                    Im creating an App in which i want to select  a value from  a selectedlistoptins  which want to change the values in other selected list

 

i.e if i selected "Engineering" option in streams selected list i want to display "IT, CSE,ECE, MECH, .." in Course selected list .

 

 

 Visual Force code is

 

 

<apex:actionRegion>
         <apex:pageBlockSectionItem >
             <apex:panelGrid columns="2">
                 <apex:outputLabel value="Streams" for="app"></apex:outputLabel>
                 <apex:outputText value="{!Application__c.Streams__c}" >                
                     <apex:selectList id="app" value="{!streamid}" size="1" >
                         <Apex:selectOptions value="{!streamvals}" />                        
                     </apex:selectList>
                     <apex:actionSupport event="onchange" status="status123" reRender="dependentcoursedetails" action="resetcourse"/>
                     <apex:actionStatus id="status123" startText="Fetching course Details . . . ."/>
                 </apex:outputText>                
             </apex:panelGrid>
         </apex:pageBlockSectionItem>
          </apex:actionRegion>
      </apex:pageBlockSection>
    
      <apex:pageBlockSection id="dependentcoursedetails">
          <apex:pageBlockSectionItem>
              <apex:panelGrid>
              <apex:outputLabel value="Course" for="courses" style="Center"/>
                  <apex:outputText value="{!Application__c.Course_Applied_For__c}" >
                  <apex:selectList id="courses">
                      <apex:selectOptions value="{!coursevals}">                         
                      </apex:selectOptions>
                  </apex:selectList></apex:outputText>
              </apex:panelGrid>
          </apex:pageBlockSectionItem>
         
      </apex:pageBlockSection>

 

 

 

Apex code is

 

 

public class appext
{
    private final Application__c application;
    list<selectoption> streams=new list<selectoption>();
    list<selectoption> courses=new list<selectoption>();
    public appext(ApexPages.StandardController controller)
    {
       this.application=(Application__c)controller.getRecord();
    }
    public list<selectoption> streamvals
    {
        get
        {
            streams.add(new selectOption('--NONE--','--NONE--'));
            streams.add(new selectOption('Arts','Arts'));
            streams.add(new selectOption('Engineering','Engineering'));
            streams.add(new selectOption('Medicine','Medicine'));
            streams.add(new selectOption('Science','Science'));
            return streams;
        }
        set;                       
    }
    public string streamid
    {
        get;set;
    }
    public list<selectoption> coursevals
    {
        get
        {

            if(streams.option.value()=='Arts'){}

              /* here im not able to select the values of the selectlist 1 which is key to select values of    

                    select list 2  */
             return courses;
        }
        set;
    }

}