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
MikeGillMikeGill
Not sure the link is correct

Did you mean this one

https://developer.salesforce.com/forums/?id=906F0000000Ac3wIAC
Jyothsna ReddyJyothsna Reddy
yes that one only 
Jyothsna ReddyJyothsna Reddy
I dont know is this possible...But If not possible is there any other way to acheive this..If you know Please guide me..
From 2weeks onwards I am struggling with this issue???????
MikeGillMikeGill
Please can you post your code?

But this may help you

public List<SelectOption> getItems(String picklistSwitcher) {
List<SelectOption> options = new List<SelectOption>()
   if (picklistSwitcher <> null){
     if (picklistSwitcher == 'Countries'){
           
            options.add(new SelectOption('US','US'));
            options.add(new SelectOption('CANADA','Canada'));
            options.add(new SelectOption('MEXICO','Mexico'));
            return options;
    } else if (picklistSwitcher == 'States'){
     
            options.add(new SelectOption('NY','New York'));
            options.add(new SelectOption('CA','California'));
            return options;
   }
  } else {
    return options
   }
}

Jyothsna ReddyJyothsna Reddy


Thanq for response..Since  I am  building the form dynamically,so I cant hardcode like picklistSwitcher == 'Countries' and picklistSwitcher == 'States'...

Any how here is my code..Please check this
Visualforce Code:
 

<apex:page controller="XXForm" showheader="false">
  <apex:form id="thefrm">
    <apex:pageBlock id="box" title="Employee Form" >
    <apex:pagemessages id="showMsg" ></apex:pagemessages>
       <apex:repeat value="{!keylist}" var="m">
          <apex:outputLabel value="{!if(m.FieldType__c == 'Combo' ,m.FieldCaption__c,'')}"></apex:outputLabel>
          <apex:outputLabel value="{!if(m.FieldType__c == 'Combo'  && m.Required__c==true,'l','')}" style="color:red;font-size:150%"></apex:outputLabel>   
          <apex:selectList value="{!inputFields[m.Id]}" size="1" rendered="{!if(m.FieldType__c == 'Combo' ,true,false)}" >
              <apex:selectoptions value="{!items}" ></apex:selectoptions>
          </apex:selectList>
          </apex:repeat>
       </apex:pageBlock>
       <apex:commandButton value="Save" action="{!mySave}" rerender="thefrm" />
    </apex:form>
</apex:page>
Controller Code:
public with sharing class XXForm {
    public String comStr {get;set;}
    public Map<Id,String> inputFields { get; set; }
    public list<mapping__c> keylist { get; set; }
    public list<string> strlist { get; set; }
    public void data(){
        keylist = new list<mapping__c>();
        inputfields = new  Map<Id,String>();   
        strlist = new list<string>();
        
        keylist = [select FieldCaption__c,FieldName__c,FieldType__c,Required__c,FieldValue__c FROM Mapping__c];
   for(Mapping__c map1:keyList){         
           inputFields.put(map1.Id,'');        
       }
    }
    public XXForm(){
        data();
    }
    public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        comStr=null;
        for(Mapping__c map1:keylist){
            if(map1.FieldType__c=='Combo'){
                comStr= map1.FieldValue__c;  
                 System.debug('comStr value is::::::::::'+comstr);
            }
        }
        strList1=comStr.split(',');
        for(String str1:strList1){
            options.add(new SelectOption(str1,str1));
        }
        return options;
    }
}

Here I am building the form dynamically...
I have MappingObject -----> Fields are::::::::::::::FieldName__c,FieldCaption__c && FieldType__c etc----
Records are
FieldName           FieldCaption           FieldType        FieldValue
_____________________________________________________
Status                  Status                            Combo      Active,In-Active
gender                 Gender                          Combo       Male,Female


Here I am trying to  get the  records based on FieldType__c(like ::::combo).

Here I have two records having m.Fieldtype as Combo.so 2 times getItems() will be called right?
So, options (returntype of getItems()) will store 2nd time value .And these values will be displayed in two SelectList values

( I want both values should be different)
Is this possible?