You need to sign in to do that
Don't have an account?
Bug in abbreviated getters and setters?
Hello
I'm getting a strange error with abbreviated getters and setters.. but when I write the full getters/setters the code works perfectly.
First, the code that works.
Extension
public class helper { SessionData__c s; public helper(ApexPages.StandardController controller) { s= new SessionData__c(); } public SessionData__c getS(){ return s; } public void setS(SessionData__c value){ s= value; } public void add(){ insert s; } }
Apex page
<apex:page standardController="SessionContainer__c" extensions="helper"> <!-- Begin Default Content REMOVE THIS --> <h1>Congratulations</h1> This is your new Page: session <!-- End Default Content REMOVE THIS --> <apex:pageblock> <apex:pageBlockSection> <apex:form > <apex:inputField value="{!S.name}"/> <apex:commandButton action="{!add}" value="Save"/> </apex:form> </apex:pageBlockSection> </apex:pageblock> </apex:page>
As I said, the above code works. Now should I change the controller extension so:
public class helper { SessionData__c s{get;set;} public helper(ApexPages.StandardController controller) { s= new SessionData__c(); } public void add(){ insert s; } }
I get the following error:
Could not resolve the entity from <apex:inputField> value binding '{!S.name}'. inputField can only be used with SObject fields.
Any ideas?
All Answers