You need to sign in to do that
Don't have an account?
Prad Nethas
Unable to get the pick list values into controller
Hi All,
I am not able to get the results when I add the picklist values to controller.
Below is the code - Please sugget me the changes to get the desired results.
<apex:page controller="searchres">
<apex:form >
<apex:pageBlock >
<apex:sectionHeader title="Search Results"/>
<apex:pageBlockSection >
<apex:panelGrid columns="2">
<apex:outputText value="Country"/>
<apex:inputText value="{!country}"/>
Qualification<apex:inputField label="Qualification" value="{!ban.Qualification__c}"/>
</apex:panelGrid><br/>
<!--<apex:selectList title="Qualification" label="Qualification">
<apex:selectOptions value="{!TypeOptions}"/>
</apex:selectList>-->
<apex:commandButton value="Search" action="{!login}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:pageBlockTable value="{!bank}" var="bnk">
<apex:column headerValue="Country" value="{!bnk.Country__c}"/>
<apex:column headerValue="Qualification" value="{!bnk.Qualification__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
///////////////Controller
public class searchres {
public string country{get;set;}
public string name{get;set;}
public string Qualification{get;set;}
public string quali{get;set;}
public list<SOV_Database__c> bank{get;set;}
Public SOV_Database__c ban{get;set;}
//this.stdAcctController = (SOV_Database__c)stdcontroller.getRecord();
public id sh;
public void login()
{
bank = [select id,country__c,qualification__c from SOV_Database__c where country__c=:country];
}
public List<SelectOption> TypeOptions
{
get
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult = SOV_Database__c.country__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry f : ple)
options.add(new SelectOption(f.getLabel(), f.getValue()));
return options;
}
}
}
I am not able to get the results when I add the picklist values to controller.
Below is the code - Please sugget me the changes to get the desired results.
<apex:page controller="searchres">
<apex:form >
<apex:pageBlock >
<apex:sectionHeader title="Search Results"/>
<apex:pageBlockSection >
<apex:panelGrid columns="2">
<apex:outputText value="Country"/>
<apex:inputText value="{!country}"/>
Qualification<apex:inputField label="Qualification" value="{!ban.Qualification__c}"/>
</apex:panelGrid><br/>
<!--<apex:selectList title="Qualification" label="Qualification">
<apex:selectOptions value="{!TypeOptions}"/>
</apex:selectList>-->
<apex:commandButton value="Search" action="{!login}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:pageBlockTable value="{!bank}" var="bnk">
<apex:column headerValue="Country" value="{!bnk.Country__c}"/>
<apex:column headerValue="Qualification" value="{!bnk.Qualification__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
///////////////Controller
public class searchres {
public string country{get;set;}
public string name{get;set;}
public string Qualification{get;set;}
public string quali{get;set;}
public list<SOV_Database__c> bank{get;set;}
Public SOV_Database__c ban{get;set;}
//this.stdAcctController = (SOV_Database__c)stdcontroller.getRecord();
public id sh;
public void login()
{
bank = [select id,country__c,qualification__c from SOV_Database__c where country__c=:country];
}
public List<SelectOption> TypeOptions
{
get
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult = SOV_Database__c.country__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry f : ple)
options.add(new SelectOption(f.getLabel(), f.getValue()));
return options;
}
}
}
now the 'selectedList' variable should represent the selected options.