Skip to main content
1 of 2

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 getAnswer() { List options = new List(); 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;}