Skip to main content
<apex:page standardController="account" extensions="selectpicklist"

 

     showHeader="true"

 

       sidebar="true">

 

<apex:form >

 

<apex:pageBlock title="Page Deatails">

 

<apex:pageBlockSection columns="1">

 

<apex:selectList label="year of passing" value="{!yearvalue}" size="1" multiselect="false">

 

<apex:actionsupport event="onchange" action="{!picklist}"/>

 

<apex:actionStatus startText="Applying value"></apex:actionStatus>

 

<apex:selectOptions value="{!yearlist}"/>

 

</apex:selectlist>

 

<!-- 2010 output panel-->

 

<apex:outputpanel id="pd1" rendered="{!yearvalue1}">

 

<apex:pageBlock title="2010 hiding details">

 

<apex:pageBlockSection columns="1" title="2010 section">

 

<apex:pageBlockSectionItem >

 

<apex:outputLabel value="accountname">

 

</apex:outputLabel>

 

<apex:inputField value="{!account.name}"/>

 

</apex:pageBlockSectionItem>

 

</apex:pageBlockSection>

 

</apex:pageBlock>

 

</apex:outputpanel>

 

<!-- 2011 output panel-->

 

<apex:outputpanel id="pd2" rendered="{!yearvalue2}">

 

<apex:pageBlock title="2011 hiding details">

 

<apex:pageBlockSection columns="1" title="2011 section">

 

<apex:pageBlockSectionItem >

 

<apex:outputLabel value="AccountName">

 

</apex:outputLabel>

 

<apex:inputField value="{!account.name}"/>

 

</apex:pageBlockSectionItem>

 

</apex:pageBlockSection>

 

</apex:pageBlock>

 

</apex:outputpanel>

 

<!-- 2012 output panel-->

 

<apex:outputpanel id="pd3" rendered="{!yearvalue3}">

 

<apex:pageBlock title="2012 hiding details">

 

<apex:pageBlockSection columns="1" title="2012 section">

 

<apex:pageBlockSectionItem >

 

<apex:outputLabel value="AccountName">

 

</apex:outputLabel>

 

<apex:inputField value="{!account.name}"/>

 

</apex:pageBlockSectionItem>

 

</apex:pageBlockSection>

 

</apex:pageBlock>

 

</apex:outputpanel>

 

</apex:pageBlockSection>

 

</apex:pageBlock>

 

</apex:form>

 

</apex:page>

 

public with sharing class selectpicklist {

 

    public selectpicklist(ApexPages.StandardController controller) {

 

    }

 

public string yearvalue{set;get;}

 

     public string yearvalue1{set;get;}

 

     public string yearvalue2{set;get;}

 

     public string yearvalue3{set;get;}

 

     public list<selectoption>getyearlist()

 

     {

 

    

 

     list<selectoption> options = new list<selectoption>();

 

     options.add(new selectoption(',','---None--'));

 

     options.add(new selectoption('100','2010'));

 

     options.add(new selectoption('200','2011'));

 

     options.add(new selectoption('300','2012'));

 

     return options;

 

     }

 

     public void picklist()

 

     {

 

     if(yearvalue=='100')

 

     {

 

     yearvalue1='true';

 

    yearvalue2='false';

 

     yearvalue3='false';

 

     }

 

     else

 

          if(yearvalue=='200')

 

          {

 

          yearvalue2='true';

 

     yearvalue1='false';

 

     yearvalue3='false';

 

     }

 

       else

 

       {

 

       yearvalue1='false';

 

       yearvalue2='false';

 

       yearvalue3='false';

 

       }

 

      }

 

      }
3 respuestas
0/9000