0 votes
in SoSci Survey (English) by s155876 (140 points)
edited by SoSci Survey

I have four pages that should go to four different groups. For some reason, one page seems to appear twice and it is never the same.

This is the code I entered, based on the instructions on the website.

if (value('NU08') == 1) {
  question('NU09');
} elseif (value('NU08') == 2) {
  question('NU03');
} elseif (value('NU08') == 3) {
  question('NU06');
} elseif (value('NU08') == 4) {
  question('NU04');
} else {
  }

Also, I am providing the survey in two languages (English and German). Is it possible to embed the language selection within the introduction page, rather than having it be the first window the respondents see?

1 Answer

0 votes
by SoSci Survey (304k points)

Please make sure that...

(1) You did not drag any of the questions on the page, but have only the PHP code on the page (and maybe NU08)

(2) If that does not solve the problem, please post the debug information shown during the first and second time the page is displayed.

by s155876 (140 points)
I have only NU08 (The randomization page) and the PHP code on the page. The text that appears is as follows:
"One or more variables (NU06_01) have already been asked on page 7. Please note that the answers from page 7 are shown here and that they will be subsequently replaced. If you require multiple similar questions, please create a copy of the question."
by SoSci Survey (304k points)
Here is the manual where to find the debug information, I need from you for a more qualified answer: https://www.soscisurvey.de/help/doku.php/en:create:debugging
by s155876 (140 points)
Thank you for your feedback, here is the debug information.

First time it appears:
[Information]    Interview started (new case no. 65)
[Information]    Questionnaire base from project Innovationadoption will be used
[Processing]    Create page 7 in questionnaire base
[Content]    Create question NU08
[Information]    The random generator NU08 drew these codes: 2
[Information]    value("NU08") = 2
[Information]    value("NU08") = 2
[Content]    Create question NU03


Second time it appears:
[Information]    Interview number 65 is to be continued
[Information]    Questionnaire base from project Innovationadoption will be used
[Information]    Retention period on page 8 has been 10 seconds
[Processing]    Reading answers from page 8
[Information]    Answer missing for NU09_01
[Information]    The question NU09 is missing a required answer
[Information]    0% of the questions have been answered so far
[Processing]    Create page 9 in questionnaire base
[Content]    Create question NU03
by SoSci Survey (304k points)
Okay, it seems that you have a reference to NU03 on pages 7 and 9. What content do you have on these two pages?

>  Is it possible to embed the language selection within the introduction page

Sure. You can either add text above the language selection, or you could set one language fixed for starting, and then provide a selection question to select one plus a filter and `setLanguage()` to actually select it. But more about that in a separate question.
by s155876 (140 points)
Page 7 contains the randomization code and NU08 (Which is the random generator). Page 9 contains the question that appears twice. However, it is always a different question that appears twice.
by SoSci Survey (304k points)
Please remove any pages like page 9 - page 7 will already display the question, you do no need (must not) place the questions anywhere else.
by s155876 (140 points)
Ah, I finally understand! I tried it in a second questionnaire (which I have deleted since) and it worked! However, this creates a new issue - for one of the "groups"  (NU06) it should not only direct to a specific question, but also a short javascript code, which triggers a text dropdown (NU07). I have added a comment below to indicate where exactly this should be added.

if (value('NU08') == 1) {
  question('NU09');
} elseif (value('NU08') == 2) {
  question('NU03');
} elseif (value('NU08') == 3) {
  question('NU06');// <-- I need to include the javascript code and the dropdown here...
} elseif (value('NU08') == 4) {
  question('NU04');
} else {
  }
by SoSci Survey (304k points)
No problem. Let's assume that you have stored the JavaScript and the dropdown questions as text with ID NX01 and question with ID NX02, then cou can simply include them in the filter:

if (value('NU08') == 1) {
  question('NU09');
} elseif (value('NU08') == 2) {
  question('NU03');
} elseif (value('NU08') == 3) {
  question('NU06');
  question('NX01');
  question('NX02');
} elseif (value('NU08') == 4) {
  question('NU04');
}
by s155876 (140 points)
Ok, I think we're getting there. I am getting this error message now when I test it in debug mode "There is no question with the ID FB in this project.". I wonder if I am looking at the right field to find the ID for the javascript code.
by SoSci Survey (304k points)
> There is no question with the ID FB in this project.

We have been talking about PHP code so far. If I understand your question correctly, this is now a JavaScript problem. May I suggest you create a dummy page or dummy questionnaire with the three elements that you're using and post a pretest link to that page in a separate question? It's getting a bit stuffy here in the comments ;)
by s155876 (140 points)
I think this may still be related to the PHP code, as the javascript code is working on its own. It's just the incorporation into the randomization. Do you think it may be because the javascript code is not technically a question and therefore it doesn't recognize the ID?
I can still create a new question, if you like. Just let me know :)
Here is the pretest link: https://www.soscisurvey.de/Innovationadoption/?act=udwYywEO5aFmaiFQrJgSHwMr
by SoSci Survey (304k points)
Hard to say ... the pretest URL does not allow for the debug bar. And if I am correct, I would need that bar in order to choose the right value for NU08 (value 3), correct? On what page do you have the troublesome contents?
by s155876 (140 points)
Sorry, I think I posted the wrong link. This should be correct one: https://www.soscisurvey.de/Innovationadoption/?act=3iz2fv6PUCsgkNAs0dBusVWp
I think you will need to open the pretest link a few times until the correct "group" (question NU06) appears and you can see the error message.
by SoSci Survey (304k points)
Okay, thanks, now I see what you mean. What does your current PHP code look like?
by s155876 (140 points)
This is the current code. I think it may be because it says question('FB'), although it's not a question, but a code/text? But I'm not sure.

if (value('NU08') == 1) {
  question('NU09');
} elseif (value('NU08') == 2) {
  question('NU03');
} elseif (value('NU08') == 3) {
  question('NU06');
  question('NU07');
  question('FB');
} elseif (value('NU08') == 4) {
  question('NU04');
} else {
  }
by SoSci Survey (304k points)
> question('FB');

If you have stored FB as a text in a section, than it must have a 4-letter ID. If you stored it in the "text elements" then please use text() instead of question():

text('FB');
by s155876 (140 points)
That did the trick! Thank you so much for your help, you're a hero! :)

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

...