0 votes
in SoSci Survey (English) by s240257 (125 points)

On one page I have a yes/no question. If yes is pressed, I am displaying 3 follow up questions with the code below. I however want to avoid NA's. Therefore, I would like to add a code snipped that forces participants to fill all DISPLAYED Items. Is this possible, and if yes could anyone provide a code? Thx so much!

<script type="text/javascript">
var optionA = document.getElementById("CA37_01a");  // "Ja"
var optionB = document.getElementById("CA37_02a");  // "Nein"
var fragebe = document.getElementById("CA32_qst");  // Question anzeige

function toggle() {
  if (optionA.checked) {
    fragebe.style.display = "";

  } else {
    fragebe.style.display = "none";

SoSciTools.attachEvent(optionA, "click", toggle);
SoSciTools.attachEvent(optionB, "click", toggle);

// -->

1 Answer

0 votes
by SoSci Survey (310k points)
selected by s240257
Best answer

I understand your situation as follows: The additional question CA32 is displayed dynamically, and you cannot use the integrated completion check, because it would also trigger if the question CA32 does not show up at all.

So the individual response check should trigger if (a) CA37 has the response code 1, and (b) any item in CA32 is missing. Let's put that down in code:

$missing = getItems('CA32', 'missing');
if ((value('CA37') == 1) && !empty($missing)) {
  repeatPage('XY01');  // You need to create a text for the error message, if you like any

Does that make sense to you?

by s240257 (125 points)
Thank you very much for your answer! You solved my problem! <3

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen

Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question