You need to sign in to do that
Don't have an account?
MyGodItsCold
'Invalid constructor name' for custom controller containing custom object
When I save my Controller, I get: Error: Compile Error: Invalid constructor name: getTeamContact at line 4 column 8
I created a custom object: TeamContact__c
In my Page editor, I have the following:
Code:
In my Controller editor, I have the following:
<apex:page controller="mailListController001" tabStyle="MailingList__c"> <apex:pageBlock title="Mail List Manager - For: {!$User.FirstName} {!$User.LastName}"/> You have {!TeamContact.id}. </apex:page>
In my Controller editor, I have the following:
Code:
The page is named ml001
public class mailListController001 { TeamContact__c TeamContact; public getTeamContact() { if (TeamContact == null) { TeamContact = [select id from TeamContact__c]; } return TeamContact; } }
The page is named ml001
I'm trying to KISS, but feeling a bit S
Thanks..
It is not required to declare public in controller by default it takes private
You are missing the return type of your getter function, every function should have a return type otherwise it tries to inerpret as a constructor while the constructior name must be same as the class name, so it is complaining. Hope you get it.