0 votes
ago in SoSci Survey (English) by s302449 (110 points)

I'm trying to randomly assign one of three different audio clips to a single group of participants. I see a PHP-code for two groups but not for a single group. Which PHP-code do I need?

ago by SoSci Survey (328k points)
I am not sure, if I get your question right. Do you have a single experimental group, and present them with 3 audio clips in a within-subject design? Or do you have a single group of respondents and want to split them into 3 experimental groups to present each one with an audio file (between-subject, one audio per respondent)? Or do you maybe intend something entirely different?
ago by s302449 (110 points)
I have a single group of participants who are listening to one audio then fill out the survey. That part is done. Once they have taken the first survey, I'd like to split them up into 3 different groups, randomly assigning them one of 3 audio clips. Afterwards, they will fill out another survey. Essentially, I'm testing within the subjects and between 3 groups. I hope that makes more sense.

1 Answer

0 votes
ago by SoSci Survey (328k points)

I have a single group of participants who are listening to one audio then fill out the survey.

I understand that this part is already working, and that they listen to the audio file in the survey (or in a lab before the survey starts).

I'd like to split them up into 3 different groups, randomly assigning them one of 3 audio clips.

Alright, if you do that within the questionnaire, you should be fine following the manual on randomization and then media file randomization. You can put the second part into the same questionnaire that your respondents start with.

Afterwards, they will fill out another survey.

Essentially, you only change the page that presents the audio. So the common part will just be on the next pages.

I am not sure if that explanation helps you a lot. Explain at which point you're stuck, please.

ago by s302449 (110 points)
When I edit the page, everything looks correct. When I go to random generator in manage questionnaire I get a long warning in red letters (unexpected element and element missing). When I preview my questionnaire, I get one audio and right below that an error in the PHP code. Below the error message are all three audio clips displayed. Thank you for your help. I can't seem to find my error.
ago by SoSci Survey (328k points)
> When I go to random generator in manage questionnaire I get a long warning in red letters (unexpected element and element missing).

Please tell the original wording of the message. If you dragged an element into the page and deleted the element afterwards, you may receive an error message that this element does not exists any more. Please remove it from the respective page eventually.

> Below the error message are all three audio clips displayed.

Make sure not (!) to drag the audio files on the page when you alteady embed one of it via PHP code or the random generator's HTML code.
ago by s302449 (110 points)
I removed the audio clips out of the random generator in manage questionnaire. When I preview my questionnaire, it does randomly play one of the three audio clips. That's good and exactly what I needed it to do. However, below the audio, I receive the following message:


There is an error in the PHP code:
Questionnaire Error: Command or string (text) unfinished

A command, e.g. question() is missing a semicolon or
a string (text in quotation marks) is unclosed or
the string itself contains an apostrophe, e.g. html('Let's do it!'); – if the latter is the case, please type in a backslash (\) first.
Perhaps the opening and closing braces for the statement blocks are mismatched.
PHP code

001 namespace s2survey\questionnaire\environment;
002
003 <audio id="audio_with_controls" preload="auto" autoplay controls controlsList="nodownload">
004   <source src="%random%" type="audio/mpeg" />
005 </audio>
006 return 'ok';

I am sorry, I am not very good with the coding, but I really hope to be able to resolve this issue as it is critical to my thesis. Thank you so, so much for your help in the matter.
ago by SoSci Survey (328k points)
It seems that you entered HTML code into a "PHP code" element. Please store the HTML code as text in your list of questions (in a section of your choice), and use text() or show() to embed it in the proper position. You'll then need to set the %random% placeholder above the text.

You can also enter the HTML code in the random generator, if the audio file is the only element that the random geneator is responsibe for.
ago by s302449 (110 points)
Awesome. That worked. I so appreciate the 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

...