Thanks! The first question free mentions asks respondents to think of their lives as chapters of a book and title for each chapter. Here, they aren't allowed to add more than 7 chapters.
In the next page, I added this code to create placeholders and check the number of the given chapters:
for ($i = 1; $i <= 7; $i++) {
$phase = value("A403x" . sprintf("%02d", $i)); // Fetch the title of each phase
if (!empty($phase)) {
replace("%sns" . $i . "%", $phase); // Replace placeholder with phase title
} else {
replace("%sns" . $i . "%", ""); // Clear unused placeholder
}
}
$chapterCount = 0;
if (!empty(value('A403x01'))) { $chapterCount++; }
if (!empty(value('A403x02'))) { $chapterCount++; }
if (!empty(value('A403x03'))) { $chapterCount++; }
if (!empty(value('A403x04'))) { $chapterCount++; }
if (!empty(value('A403x05'))) { $chapterCount++; }
if (!empty(value('A403x06'))) { $chapterCount++; }
if (!empty(value('A403x07'))) { $chapterCount++; }
registerVariable('chapterCount', $chapterCount);
// Register the variable for use in routing
registerVariable('chapterCount', $chapterCount);
The multiple dropdowns question ask them about their work in each phase. So the items of this question are %sns_x%. The question will not appear if the first question has not been answered. However, if the respondent gave 2 chapters, the dropdowns question will return empty items but with the dropdown list. I am looking for a solution to set the number of the items to be the same of the number of chapters. Alternativly, I would hide the dropdown list for the empty items.
I am struggling with it and hope you can support me!
Bests