You need to sign in to do that
Don't have an account?
TanD
How to bind data from multiple object in a single visualforce page?
I have two objects Speaker__c, Session__c. I want to create a single VF page which will includes fields from both objects. VF page will have inputField / inputText type of field. The class through error: Initial terms of field expression must be a concrete sObject: List
VF code through the error: Unknown property 'VFpageName.Session__c'
If I dont initiate objects with List<>, apex class will be fine, but VF page shows same error. How to fix this?
My code:
Class
VF
VF code through the error: Unknown property 'VFpageName.Session__c'
If I dont initiate objects with List<>, apex class will be fine, but VF page shows same error. How to fix this?
My code:
Class
public class SingleVFPagePullDataFromMultipleObjects { // MVC concept to data binding in VF page & controller public List<Speaker__c> objectSpeaker {get; set;} public List<Session__c> objectSession {get; set;} //define the function public SingleVFPagePullDataFromMultipleObjects(){ // Initiate objects List<Speaker__c> objectSpeaker = new List<Speaker__c>(); List<Session__c> objectSession = new List<Session__c>(); } // Save button public void save() { try { insert objectSpeaker; objectSession.Speaker_Name__c = objectSpeaker.id; insert objectSession; } catch(Exception ex) { System.debug('\n\nException ='+ex.getMessage()+'\n\n'); } } public void cancel(){} }
VF
<apex:page controller="SingleVFPagePullDataFromMultipleObjects" > <apex:form> <apex:pageBlock> <apex:pageBlockSection> <apex:inputText value="{!Session__c.Session_Date__c }" /> <apex:inputText value="{!Session__c.Description__c }" /> <apex:inputText value="{!Session__c.Level__c }" /> <apex:inputText value="{!Speaker__c.Last_Name__c }" /> <apex:inputText value="{!Speaker__c.Bio__c }" /> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
let me know if it works
All Answers
try this
and VF
:(
let me know if it works
Can you please have a look in the below problem: