function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Input Text only refers to fields?

I thought the Input Text object was for referencing class variables instead of object fields.
This code seems to work OK since Service__c.Name is a field in my custom object called Service:
<apex:inputText value="{!Service__c.Name}" id="ReplyTo_Address"/>
This one fails:
<apex:inputText value="{!emailToAddress}" id="emailToAddress"/>
I have created the appropriate getter method in the controller but when I try to save this page I get the error:
Error: Read only property 'ServiceControllerExtension.emailToAddress'
Here's the getter code from the controller extension:

public String getemailToAddress(){

emailToAddress = '';

return emailToAddress;


Any Ideas?
You also need  set method to set the value from the page to the controller. Using a property in the controller would be even easier. Then you wouldn't need a get or set method.

Set Method;

public String setemailToAddress(emailToAddress){
    this.emailToAddress = emailToAddress;

public String emailToAddress {get; set;}


That property method is MUCH easier!  :smileyvery-happy: Thanks for your help!