I am trying to populate a list of answers. I have a list of questions and an empty array of answers that I pass to a visualforce page. The code in my visualforce page is:
<apex:variable var="index" value="{!-1}"/>
<apex:repeat value="{!sow.Questions}" var="q">
<apex:outputtext style="font-size:16px" value="{!q}"/><br/>
<apex:variable value="{!index+1}" var="index"/> <!--increment-->
<td><apex:inputTextarea style="width: 400px; height: 100px" value="{!sow.Answers[index]}" id="ans" /></td><br/><br/><br/>
</apex:repeat>
The problem I am having is that when I save this, it will only save at the final index. I think because it runs asynchronously, that the controller will only see answers[2] but I may be wrong. Is there a better way to do this? Thank you