You need to sign in to do that
Don't have an account?
sfdclive
regarding dynamic apex
Hi,
I have one object(account) with a picklist field location__c having values us,uk,india,china. if i select any picklist value, records will be displayed as a table
please help me, I am new to salesforce
regards
sri
Use actionSupport to invoke this method
HI
Use <apex:actionSupport >tag for this requirement , Please go through the below sample code ,
Visualforce and its controller
============================================================
<apex:form >
<apex:pageBlock >
<apex:selectList value="{!selectop}" size="1" >
<apex:actionSupport id="pbid" event="onchange" reRender="rr" />
<apex:selectOptions value="{!records}" > </apex:selectOptions>
</apex:selectList>
<apex:dataTable value="{!selectpickvalue}" var="a" rendered="{!pb1}" id="rr" >
<apex:column value="{!a.Phone}" headerValue="Phone"/>
<apex:column value="{!a.Name}" headerValue="Name"/>
</apex:dataTable>
</apex:pageBlock>
</apex:form>
</apex:page>
// public String course { get; set; }
boolean x;
public Boolean getPb1() {
return x;
}
public Recinpicklist1 (){
x=true;
}
public boolean pb1 { set; }
public list<Contact> getSelectpickvalue() {
li=[select id,Name,Phone from Contact where name=:selectop ];
return li;
}
public Contact selectpickvalue { set; }
public String selectop { get; set; }
List<Contact> li;
public List<selectoption> getRecords() {
li=[select Name,Phone from Contact];
for(Contact c:li){
p.add(new selectoption(c.name,c.name));
}
return p;
}
List<selectoption> p= new List<selectoption>();
}