You need to sign in to do that
Don't have an account?
mamidi mahesh
what will happen internally step by step when gettypes() method will be executed.
My visualforce pag:
<apex:page standardController="Candidate__c" extensions="MyController">
<apex:form >
<apex:pageBlock title="Survey Form">
<apex:pageBlockSection title="Experience Details">
<apex:pageBlockTable style="width:165%;vertical-align:left;" value="{!expList}" var="exp">
<apex:column headerValue="Company Name" >
<apex:outputText value="{!exp.Name}"/>
</apex:column>
<apex:column headerValue="Start Date" style="width:300px">
<apex:outputText value="{!exp.Start_Date__c}"/>
</apex:column>
<apex:column headerValue="End Date" style="width:300px" >
<apex:outputText value="{!exp.End_Date__c}"/>
</apex:column>
<apex:column headerValue="Salary" >
<apex:outputText value="{!exp.Salary__c }"/>
</apex:column>
<apex:column headerValue="Document Submitted?" >
<!--<apex:outputText value="{!exp.Documents_Submitted__c}"/>-->
<apex:selectradio value="{!exp.Documents_Submitted__c}" >
<apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectradio>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Submit" action="{!submit}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
My contoller class:
public class MyController{
public List<Experiance__c> expList {get; set;}
private final Candidate__c candRec;
public MyController(ApexPages.StandardController stdController){
this.candRec=(Candidate__c)stdController.getRecord();
expList = [SELECT Id, Name, Start_Date__c, End_Date__c, Salary__c, Documents_Submitted__c FROM Experiance__c WHERE Candidate__c =: candRec.Id];
}
public List<SelectOption> getTypes(){
Schema.sObjectType sobject_type = Experiance__c.getSObjectType();
Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
List<Schema.PicklistEntry> pick_list_values = field_map.get('Documents_Submitted__c').getDescribe().getPickListValues();
List<selectOption> options = new List<selectOption>();
for (Schema.PicklistEntry a : pick_list_values) {
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}
public void submit(){
//update candRec;
update expList;
}
}
please could any one explain each line in gettypes() method in controller class that what will happen ineternally when every statement is executed.
Schema.sObjectType sobject_type = Experiance__c.getSObjectType();
List<selectOption> options = new List<selectOption>();
return options;
<apex:page standardController="Candidate__c" extensions="MyController">
<apex:form >
<apex:pageBlock title="Survey Form">
<apex:pageBlockSection title="Experience Details">
<apex:pageBlockTable style="width:165%;vertical-align:left;" value="{!expList}" var="exp">
<apex:column headerValue="Company Name" >
<apex:outputText value="{!exp.Name}"/>
</apex:column>
<apex:column headerValue="Start Date" style="width:300px">
<apex:outputText value="{!exp.Start_Date__c}"/>
</apex:column>
<apex:column headerValue="End Date" style="width:300px" >
<apex:outputText value="{!exp.End_Date__c}"/>
</apex:column>
<apex:column headerValue="Salary" >
<apex:outputText value="{!exp.Salary__c }"/>
</apex:column>
<apex:column headerValue="Document Submitted?" >
<!--<apex:outputText value="{!exp.Documents_Submitted__c}"/>-->
<apex:selectradio value="{!exp.Documents_Submitted__c}" >
<apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectradio>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Submit" action="{!submit}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
My contoller class:
public class MyController{
public List<Experiance__c> expList {get; set;}
private final Candidate__c candRec;
public MyController(ApexPages.StandardController stdController){
this.candRec=(Candidate__c)stdController.getRecord();
expList = [SELECT Id, Name, Start_Date__c, End_Date__c, Salary__c, Documents_Submitted__c FROM Experiance__c WHERE Candidate__c =: candRec.Id];
}
public List<SelectOption> getTypes(){
Schema.sObjectType sobject_type = Experiance__c.getSObjectType();
Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
List<Schema.PicklistEntry> pick_list_values = field_map.get('Documents_Submitted__c').getDescribe().getPickListValues();
List<selectOption> options = new List<selectOption>();
for (Schema.PicklistEntry a : pick_list_values) {
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}
public void submit(){
//update candRec;
update expList;
}
}
please could any one explain each line in gettypes() method in controller class that what will happen ineternally when every statement is executed.
Schema.sObjectType sobject_type = Experiance__c.getSObjectType();
- what will happen internally while above line is being executed?
- what will happen internally while above line is being executed?
- what will happen internally while above line is being executed?
- what will happen internally while above line is being executed?
List<selectOption> options = new List<selectOption>();
- what will happen internally while above line is being executed?
- what will happen internally while above line is being executed?
- what will happen internally while above line is being executed?
return options;