0 votes
ago in Methoden-Fragen by s298456 (110 points)

We would like to restrict two answers in a question: the response ER04-01 of question ER04 should be greater than ER04-02. We applied the following code in the "PHP for Processing Responses" section:

php
$val1 = value('E04_01');
$val2 = value('E04_02');

if (is_numeric($val1) && is_numeric($val2)) {

if ($val1 <= $val2) {
    stopPage("Drug (%) must be greater than Placebo (%). Please correct your input.");
}

}
However, the system keeps showing the following warning:
Warning: The funktion stopPage() is not known.

Attachment is the page screenshot.

Could you please help us figure out the issue or show us the correct way to implement this code?

Thank you very much for your support.

1 Answer

0 votes
ago by SoSci Survey (348k points)

The function stopPage() must not be used in the "PHP for Processing Responses". This command only stops creation of the current page, and therefore does not make sense in processing. What youre looking for is repeatPage()`.

To use repeatPage() properly, please create a "New Text" in one of your sections, and write the "Drug..." text there. If you would likle to use placeholders, please use valid placeholders.

Let's say, your text hat the ID TX01, then your code would look like this:

if (value('E04_01') <= value('E04_02')) {
  replace('%placeholder1%', 'E04_01', 'response');
  replace('%placeholder2%', 'E04_02', 'response');
  repeatPage('TX01');
}

Important: Make sure that the variable IDs E04_01/E04_02 are correct, they may be, but are probably not.

And, please keep in mind, that answers from AI tools are right oly in 64% of the cases - on average. And they're much worse regarding SoSci Survey. Approximately 10%.

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

...