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
ran67ran67 

Dynamic Picklist value to display record on click of Picklist value

Hi

I have created an dynamic Picklist 

suppose

I have four value in Picklist

Picklist value A

Picklist value B

Picklist value c

Picklist value D

.Each Picklist value Has some record  when i click on that Picklist value it must excute  display that records onthe Page

Please Help Me to resolve it

 

thanks in advnace

PremanathPremanath

You mean onchange of picklist

 

if yes

 

<apex:selectList value="{!chosen1}"  onchange="function();">
<apex:selectOptions value="{!items}"/>
</apex:selectList>

 

<apex:actionFunction name="function" action="{!Search}"  />

 

Then it calls a method in apex

 

public string chosen1{get;set;}  // it gives selected pick list value

 

public void search(){

// Write your code // Query getting records

//then Use page block table return all you want the records

}

 

 

Thanks

Premanath

 

 

ran67ran67

Hi 

I have Tried has told But am getting null value into the chosen1 so i cannot Perform another Operation

 

can u please help me to solve  myproblem

PremanathPremanath

The pick-list return from class like this Right

 

public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US1','US'));
options.add(new SelectOption('CANADA1','Canada'));
options.add(new SelectOption('MEXICO1','Mexico'));
return options;
}

 

You must and sholud get the value on change --> US1, CANADA1 ,  MEXICO1

 

Do one thing on page load means on Construcor also write  

 

chosen1='US1';  It is default.

 

 

I have used that pick list value in so many cases it must gives the value

It doesn't give null value i am sure ..

 

May be your doing some mistake things

 

You can correct them

 

 

Prem

 

 

 

ran67ran67

Hi 

I am Not adding the dynamically .here into the Picklist value are cmg from the Response on http request

so it nt cmg i think .can u  suggest me another way

PremanathPremanath

I don't think so about Http Request 

I think you are geeting that field from class only Right?

Like

 Schema.DescribeFieldResult dfield=fieldMap.get(pickfldvals).getDescribe();

 

Here also i think you get that value, I have used in this requirement also By using Map

 

But Http Request  Means i don't know

ran67ran67

No am getting these value from s3 amazon.it is response.

I have kept the Response in a picklist .

Now when i select one  value.

the select value Pass to the another Request and then it generate an output

 

 

thanks in advance