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
jayesh pagarejayesh pagare 

How do I pass array with multiple select option with related question???

Here is my code and currently i am successfully passing single option selected in array to apex controller but now want to pass multiple option for same question.

Javascript Code:
​<script type="text/javascript"> var ansArray = []; ansArray[0] = ""; ansArray[1] = ""; ansArray[2] = ""; ansArray[3] = ""; ansArray[4] = ""; function changeValue(input,textid,count,id) { ansArray[count] = input.value; alert(ansArray); } </script> <script> function SubmitSurvey(node){ InvokeController(JSON.stringify(ansArray)); <!--alert(JSON.stringify(ansArray));--> } </script>

VF Page:
<apex:variable var="count" value="{!0}"/> <apex:repeat value="{!Questions}" var="q"> <!-- Question style one --> <apex:outputPanel rendered="{!IF(q.Related_Question__r.Type__c='Radio',true,false)}" id="RadioPanel"> <div class="Que1"> <apex:outputField value="{!q.Related_Question__r.Question__c}"/> <div class="OptionDiv"> <apex:form > <div style="padding: 20px;"> <apex:selectRadio styleClass="Source" value="{!SelectedValue}" id="RadioButtonValue" onclick="changeValue(this,'{!$Component.RadioButtonValue}',{!count});" > <apex:selectOption itemLabel="{!q.Option_One__c}" itemValue="{!q.Option_One__c}" ></apex:selectOption> <apex:selectOption itemLabel="{!q.Option_Two__c}" itemValue="{!q.Option_Two__c}" ></apex:selectOption> <apex:selectOption itemLabel="{!q.Option_Three__c}" itemValue="{!q.Option_Three__c}" ></apex:selectOption> <apex:selectOption itemLabel="{!q.Option_Four__c}" itemValue="{!q.Option_Four__c}" ></apex:selectOption> <apex:selectOption itemLabel="{!q.Option_Five__c}" itemValue="{!q.Option_Five__c}" ></apex:selectOption> </apex:selectRadio> </div> <apex:variable value="{!count+1}" var="count"/> </apex:repeat>