Find your content:

Search form

You are here

Auto Populate fields on the basis of Pick List value

 
Share

I have one Pick List and two text fields. I want to auto enter text in the two fields on the basis of value selected in picklist. For example : Values in Pick List are A and B. While filling the details if A is selected the in both text fileds 'You have selected A' should come automatically and if I select B then 'You have selected B' . How can I do that?


Attribution to: Ajay Sainy

Possible Suggestion/Solution #1

You can do something like this :

public class CopyPickListValues {
public string values{get; set;}
public string str1{get; set;}
public string str2{get; set;}

public CopyPickListValues(){
 values='A';
 getItems();
 showValues();
}
public list<SelectOption>getItems(){
 list<SelectOption>options=new list<SelectOption>();
 options.add(new selectOption('A','A'));
 options.add(new selectOption('B','B'));
 return options;
}

It is an example of what you are trying to achieve.


Attribution to: Ajay Dubedi
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33931

My Block Status

My Block Content