You need to sign in to do that
Don't have an account?
xpat
Child data in visualforce page
Hello,
I am new in visualforce
I have a visualforce page with standardaccount controller, i saw in the documentation that you can access to child data
but i get an error
I want to display on one page account fields and custom object fields
<apex:page standardController="Account" id="pageaccountdetails">
<apex:sectionHeader title="Yearly Account Plan"/>
<apex:sectionHeader title="Yearly Account Plan"/>
<apex:inputField value="{!account.yearlyplans__r.year__c}"/>
yearlyplans is the name I gave for the child relationship between account and my custon object
I try with outputfield and outputext but doesn't work
How can I display on one page custom object fields with the standardcontroller?
Thanks for your help
Pat
This is alternate solution..
u can use extension and
Account acc=new Account();
public Account getAccount(){
acc=[select yearlyplans__r.year__c from Account];
Thanks for your answer, will try
So if I understand you can access to child data and display as a list or table with the standard Controller but you need to build an extension if you want to be able to modify or enter data.
A we have a standard controller for each object (standard or custom) can't we use as controller extension the custom object controller as both objects are linked with the relationship __r?
Pat
public Coupon_Requested__c getpromo() {
return [select id, Name from Coupon_requested__c where Case_pack_status__c= 'Active' and IsCP__c = 1 and Account__c = :System.currentPageReference().getParameters().get('id')];
}
but now I have another issue
public Coupon_Requested__c getpromo() {
return [select id, Name from Coupon_requested__c where Case_pack_status__c= 'Active' and IsCP__c = 1 and Account__c = :System.currentPageReference().getParameters().get('id')];
}
Thanks for your help
I fixed it, but not in a clean way but it works. will see if I can find something better later
public Coupon_requested__c getpromo() {
for (Coupon_requested__c a : [select Name from Coupon_requested__c where Case_pack_status__c= 'Active' and IsCP__c = 1 and Account__c = :System.currentPageReference().getParameters().get('id')]){
return a;
}
return null;
}