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
tgganeshtgganesh 

setter method not firing

Hi all,

 

I have write a code to store a value, just for checking i added debug comment in setter method. but in debug logs am not receiving the values. it seems like setter method is not working properly.

 

public class chooseColor {
    String sCheckboxAnswers;
    
    public String getSCheckboxAnswers(){
        return sCheckboxAnswers;
    }
    
    public void setSCheckboxAnswers(String sCheckboxAnswers ){       
        system.debug('Checkbox value +++++'+sCheckboxAnswers ); 
        this.sCheckboxAnswers = sCheckboxAnswers ;
    }
}

 

<apex:page controller="chooseColor">
    <apex:form > 
    <apex:selectCheckboxes id="chooseColor3" value="{!sCheckboxAnswers}">
        <apex:selectOption itemValue="red" itemLabel="Red"/>          
    </apex:selectCheckboxes>
    </apex:form>
</apex:page>

 

can anyone tell me.. what mistake i have done.?

 

bob_buzzardbob_buzzard

You don't appear to have a mechanism to submit the form - how does the user post back the values?

AmitSahuAmitSahu

add some event to this page :

 

<apex:selectOption itemValue="red" itemLabel="Red" onclick="do something here"/>