Trying to prefill multiple-choice question

More
4 years 3 days ago #119248 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!

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
4 years 3 days ago #119252 by holch
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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
4 years 3 days ago #119259 by tpartner
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:
.../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

Please Log in or Create an account to join the conversation.

More
3 years 11 months ago #119750 by davidmenefee
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!

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!