Editable summary / overview of open-ended questions
The aim is to edit the content of all open-ended questions (not inside a loop) , when the call is finished in CATI or if you want to propose to the respondent to correct his/her data .
Please be carefull , each modification will be applied on the source question .
So if you want to keep previous answers , we strongly recommend to duplicate your questions.
Do you know when you prefix by "_" the shortcut of the question, you can change the content of the question source ?
In order to help you to summarize the questions, we have create an example in the 📥attached qex with 2 closed questions and 2 open-ended.
Create a chapter and insert the following script :
Using questions shortcut
<div id="question"> !!Qopen1.shortcaption!! </div>
<textarea name="_Qopen1" class="inputopen" aria-label="Text area" >!!Qopen1.InputValue()!! </textarea>
<br/><br /><br />
<div id="question">!!Qopen2.shortcaption!! </div>
<textarea name="_Qopen2" class="inputopen" aria-label="Text area" >!!Qopen2.InputValue()!!</textarea>
<br/><br /><br />
as result , you will have :
Using questions tag
But when you have more than 2 questions ;) it could be usefull to use a generic script .
We will use the tags to extract a set of questions .
We will iterate on all survey.questions with the tag "OpenSummary".
In our 📥 attached example , we have 2 questions wity this tag ( ??Qopen1?? and ??Qopen2??) , so 'arrQuestions.count ' = 2 .
Create a chapter and insert the following script
!! Dim arrQuestions = Survey.Questions.FilterByTag("OpenSummary")
Dim str =""
Dim i
For i = 1 To arrQuestions.Count
If arrQuestions[i].HasNoData = False Then
str = str + "<div id='question'><br /><br />" + arrQuestions[i].shortcut +" - " + arrQuestions[i].shortcaption +"<br /><br /><textarea aria-label='Text area' class='inputopen' name='_"+ arrQuestions[i].shortcut +"'>" + arrQuestions[i].InputValue() + "</textarea></div><br /><br />"
EndIf
Next
return str !!
and you will have
And why not add also some single closed questions in our summary ?
Using questions tag and questions type
We will use the tags to extract a set of questions .
We will iterate on all survey.questions with the tag "Summary".
In our 📥 attached example , we have 4 questions with this tag (??Q1??, ??Qopen1??, ??Q2?? and ??Qopen2??) , so 'arrQuestions.count ' = 4 .
Create a chapter and insert the following script
!! Dim arrQuestions = Survey.Questions.FilterByTag("Summary")
Dim i
Dim str=""
Dim strA=""
dim j
dim result=""
Dim isChecked = ""
For i = 1 To arrQuestions.Count
If (arrQuestions[i].HasNoData = False) then
If (arrQuestions[i].Type ="single") Then
strA= "<div id='question'>" + arrQuestions[i].shortcut +" - " + arrQuestions[i].shortcaption +" </br></br><table border='0' align='left'>"
result=""
For j=1 to arrQuestions[i].AvailableResponses.count
isChecked = On(arrQuestions[i].AvailableResponses[j].IsSelected,"checked=\"checked\"","")
result = result + "<tr ><td width='10%'><input type='radio' id='choice("+j+")' name='_"+ arrQuestions[i].shortcut +"' value='"+ arrQuestions[i].AvailableResponses[j].InputValue() + "' " + isChecked + " /><label for='choice("+j+")'>"+ arrQuestions[i].AvailableResponses[j].caption+"</label></td></tr>"
next
str= str + strA + result +"</table></div>"
else
str = str + "<div id='question'>" + arrQuestions[i].shortcut +": <textarea aria-label='Text area' class='inputopen' name='_"+ arrQuestions[i].shortcut+"'>" + arrQuestions[i].InputValue() + "</textarea></div><br /><br />"
endif
EndIf
Next
return str !!
And you will have