- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Trying to prefill multiple-choice question
- davidmenefee
- Topic Author
- Offline
- New Member
Less
More
8 years 11 months ago #119248
by davidmenefee
Trying to prefill multiple-choice question was created by davidmenefee
Hi folks
I want to prefill a multiple-choice question from the URL, but I can't get it working. I've tried the suggestions on these pages:
manual.limesurvey.org/Workarounds:_Surve...using_the_survey_URL
manual.limesurvey.org/Expression_Manager#Qcode_Variable_Naming
I exported a survey result with question and answer codes. The first question in the first group is identified in the exported data like this:
question code: groups[5393]
answer code: Y
I've tried these URLs (I've removed the base URI for clarity):
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups[5393]=Y
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups[5393]=1
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups[5393]="Y"
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups[5393]='Y'
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups_5393='Y'
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/groups/5393/Y
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/groups[5393]/Y
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/groups?5425=Y
Also tried the SGQA identifier:
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/925635X1X536X5393/1
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?925635X1X536X5393=Y
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?925635X1X536X5393='Y'
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?925635X1X536X5393='1'
This worked for a different, single-choice drop-down list question:
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/School/5393
So I know passing answers via the URL *should* work.
thanks for any help!
I want to prefill a multiple-choice question from the URL, but I can't get it working. I've tried the suggestions on these pages:
manual.limesurvey.org/Workarounds:_Surve...using_the_survey_URL
manual.limesurvey.org/Expression_Manager#Qcode_Variable_Naming
I exported a survey result with question and answer codes. The first question in the first group is identified in the exported data like this:
question code: groups[5393]
answer code: Y
I've tried these URLs (I've removed the base URI for clarity):
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups[5393]=Y
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups[5393]=1
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups[5393]="Y"
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups[5393]='Y'
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?groups_5393='Y'
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/groups/5393/Y
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/groups[5393]/Y
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/groups?5425=Y
Also tried the SGQA identifier:
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/925635X1X536X5393/1
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?925635X1X536X5393=Y
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?925635X1X536X5393='Y'
.../index.php/survey/index/sid/925635/newtest/Y/lang/en?925635X1X536X5393='1'
This worked for a different, single-choice drop-down list question:
.../index.php/survey/index/sid/925635/newtest/Y/lang/en/School/5393
So I know passing answers via the URL *should* work.
thanks for any help!
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11746
- Thank you received: 2750
8 years 11 months ago #119252
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Trying to prefill multiple-choice question
I asume that groups[5393] is your questioncode and it is a multiple answer question, how should limesurvey know which of the answers to tick? You have to look at the survey/question logic page to see how each subquestion is referenced. Probably by adding using something like groups[5393]_1 and so on. And i am not sure if you are allowed to use those brakets in a questioncode.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3691
8 years 11 months ago #119259
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Trying to prefill multiple-choice question
If, for example, the sub-question codes are "SQ001, SQ002...", using the full SGQA (no "X" between the question and sub-question codes) should work:
Code:
.../index/sid/925635/newtest/Y/lang/en?925635X1X536SQ001=Y
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: davidmenefee
The topic has been locked.
- davidmenefee
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
8 years 10 months ago #119750
by davidmenefee
Replied by davidmenefee on topic Trying to prefill multiple-choice question
I ended up using a different approach that didn't require that I pass an answer to a multiple-choice question. I couldn't get the latter to work, even with your last suggestion, unfortunately. Passing an answer to a single-choice question worked fine. Thanks!
The topic has been locked.