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

Subject: Random generator + PHP text() shows no stimulus, jumps to final page

Hello,

I am building a three-arm between-subject experiment for my master's thesis at the University of Kassel and cannot get the randomised text display to work. I have followed the manual pages "Randomization with PHP-Code" and "Randomization: Texts" but the stimulus never appears.

Test project name: randomisation
(This is a minimal test project I built to isolate the problem.)

WHAT I HAVE SET UP

Section TR contains:
- TR01 "control" — created with Add Text, content: THIS IS CONTROL
- TR02 "Treatment1" — created with Add Text, content: THIS IS TREATMENT 1
- TR03 "Treatment 2" — created with Add Text, content: THIS IS TREATMENT 2
- TR04 "arm" — question type Random Generator

TR04 Codes (contents) currently reads:
1 = 1
2 = 2
3 = 3

The "Drawn yet" column shows draws are happening (e.g. 3: 1), so the generator itself appears to work.

Questionnaire page 01 contains, in this order:
1. TR04 (the random generator)
2. A PHP code element placed below it, in the page content area (not in the "PHP for Processing Responses" box)

The PHP code is:

if (value('TR04') == 1) {
text('TR01');
} elseif (value('TR04') == 2) {
text('TR02');
} else {
text('TR03');
}

TR01, TR02 and TR03 are NOT placed on any questionnaire page, as the manual instructs.

WHAT HAPPENS

When I start the questionnaire (starting a new interview, not refreshing with F5), no text is displayed. The questionnaire goes straight to the final page: "Thank you for completing this questionnaire!"

No error message is shown.

WHAT I HAVE ALREADY TRIED

  • question('TR01') instead of text('TR01') — same result, no display
  • An urn instead of a random generator. urnDraw('treat') returned: "There are not enough parameters for the function urnDraw(). Please specify 2 parameter(s)." Adding a second parameter for a storage variable did not resolve it, as I could not create a suitable internal variable.
  • echo for debugging — blocked: "The PHP keyword echo is not allowed within PHP code."
  • Confirmed the PHP element is in the page content area, not the processing-responses area
  • Confirmed I start a new interview rather than refreshing

MY QUESTIONS

  1. Is text() the correct function for elements created with Add Text, and is my syntax correct?
  2. Should the Codes (contents) of the random generator contain plain numbers (1, 2, 3), or does it need something else for use with value()?
  3. Is there a setting on the Random Generator question (for example under Display Contents, Management, or Variables) that must be configured before value() will return the drawn code?
  4. Is there a way to display the drawn value on screen for debugging, given that echo is not permitted?

I would be very grateful for any help. I need this working before I can begin data collection.

Thank you very much

ago by SoSci Survey (377k points)
Your code looks good, so far. Please kindly post the debug information shown on the page (https://www.soscisurvey.de/help/doku.php/en:create:debugging). If no debug information is displayed due to the exit page, please add an additional page that just hat the HTML code "<p>Test</p>" or any other text on it.

Also, please make sure that you don't have another questionnaire created unter "Compose Questionnaire" -> "Manage Questionnaires". Maybe, it's just the wrong questionnaire starting.

Please log in or register to answer this question.

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

...