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
salesforcedev.ax840salesforcedev.ax840 

want to display new options when one select option is used

Hi,

 I am developing a select list. when one option is selected from list it must show some apex code where it display input field and other radio buttons...

for  example if i select country it must dispplay state,district,code and if i change option to address it must display street number,house number.

 

can anyone help me. i wrote select list and selectoptions :

 

 

<apex:selectList size="1" value="{!selectafield}"  >
<apex:selectOptions Value="{!selectfield}" />

 

<apex:selectList size="1" value="{!selectafield}"  ><apex:selectOptions Value="{!selectfield}" />

 

 

 

and in controller i wrote the selectoptions:

String[] selectafield = new String[]{};

 

public List<SelectOption> getselectfield() {

        List<SelectOption> options = new List<SelectOption>();

        options.add(new SelectOption('country ','country'));

        options.add(new SelectOption('address ','address'));

       return options;

    }

 

 

public String[] getselectafield() {

        return selectafield;

    }

 

    public void setselectafield(String[] seelctafield) {

        this.selectafield = selectafield;

    }

 

please reply... 

need help..

thank you

 

AmulAmul

writedown onchange attribute and add some apex call method here.

AmulAmul

either you can use actionsupport tag,...

 

eaxmple................

 

 

<apex:page standardController="Opportunity" recordSetVar="opportunities"
tabStyle="Opportunity"
sidebar="false">
<apex:form>
<apex:pageBlock>
<apex:pageMessages/>
<apex:pageBlock>
<apex:panelGrid columns="2">
<apex:outputLabel value="View:"/>
<apex:selectList value="{!filterId}" size="1">
<apex:actionSupport event="onchange" rerender="opp_table"/>
<apex:selectOptions value="{!listviewoptions}"/>
</apex:selectList>
</apex:panelGrid>
</apex:pageBlock>
<apex:pageBlockButtons>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!opportunities}" var="opp" id="opp_table">
<apex:column value="{!opp.name}"/>
<apex:column headerValue="Stage">
<apex:inputField value="{!opp.stageName}"/>
</apex:column>
<apex:column headerValue="Close Date">
<apex:inputField value="{!opp.closeDate}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>