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
yeshabyeshab 

Set method not called in apex:repeat

I am displaying a set of questions and answer for it is either yes or no. these set of questions come from a object. the set method is not getting executed. below is my code

The objectName is the method that gets the set of questions from custom object.

<apex:repeat value="{!objectName}" var="q">
<apex:selectRadio value="{!Response}">
<apex:outputtext style="color:green;" escape="false" value="{!q.Questions__c}" />
<apex:selectOptions value="{!Answer}" />
</apex:selectRadio>

<apex:outputtext value="{!Answer}"/>
<apex:outputtext value="{!Response}"/>     
</apex:repeat>

---------------------------------------Class Code---------------------------------------------------------------
public List<SelectOption> getAnswer() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Yes','Yes'));
options.add(new SelectOption('No','No'));
return options;
}

public void setResponse(String[] Response) {


    if(Response != null)
      this.Response = Response;
    else{
        list<String> arrStr = new list<string>();
        arrStr.add('No');
      this.pResponse = arrStr;
    }
}

public string[] getResponse(){ return Response;}
PrasanntaPrasannta (Salesforce Developers) 
Hi,

Please try Declaring your variable as -

transient global String amount {get; set;}
OR
transient public String amount {get; set;}

By default, a method or variable is visible only to the Apex code within the defining class. If you do not specify an access modifier, the method or variable is private.

Hope this information helps.