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

I have a multiple choice question (not required) and I want all the selected items to be subquestions in the next matrix question (Likert scale). However the last item in the multiple choice question is exclusive and has a input field for text. The text of the input field has to be displayed as a item in the matrix question when the last item is selected.

E.g.:
Multiple choice question:

Next question:

Can anyone help me with the php code?

Thank you!

1 Answer

+1 vote
by SoSci Survey (328k points)

The text of the input field has to be displayed as a item in the matrix question when the last item is selected.

You'll need a placeholder for this.

The PHP code is quite simple:

replace('%fourthItem%', 'MC01_01a', 'response');

The explanation (Sonstiges-Eingabefelder) has unfortunately not yet been translated to English. So please feel free to ask for details.

by s115361 (125 points)
Thank you,

I'd already contructed the php code of that input field. That wasn't the problem here:
$antwoordAC0404a = value('AC04_04a', 'text');
$antwoordAC0404a = trim($antwoordAC0404a);
replace('%antwoordAC0404a%', $antwoordAC0404a);
And %antwoordAC0404a% in the matrix question.

The problem is that I can't get the selected items of the multiple choice question  in the matrix question. So if not selected then it must not displayed in the matrix question.
by SoSci Survey (328k points)
I assume, you're using getItems(). What does is return?

$items = getItems('AC04');
debug($items);

Does the placeholder item in the follow-up question have the ID 4?

What is you PHP code to display the follow-up question, anyway? Have you already found this manual: https://www.soscisurvey.de/help/doku.php/en:create:filter-items
by s115361 (125 points)
My code:

$selected = getItems('AC04', '==', 2);
if (count($selected) > 0) {
    question('AC06', $selected);
}
else{
    goToPage('next');
}

Thats fine for the selected items 1 to 3 of the multiple choice question AC04. But I want the text of the input field of the selected item 4 (in the example: 'lage kosten') to be displayed in the matrix question AC06 and not the label 'andere stimulerende factoren'.
by SoSci Survey (328k points)
> and not the label 'andere stimulerende factoren'.

Are ypu sure, you have used the placeholder %antwoordAC0404a% as itemtext for AC06, forth item?
by s115361 (125 points)
You are right, that wasn't the case!

Thank you for your help!

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

...