- Posts: 15
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Prefilling answer with listbox / checkboxes questions types
- simogeo
- Topic Author
- Offline
- New Member
Less
More
6 years 3 months ago #161955
by simogeo
Prefilling answer with listbox / checkboxes questions types was created by simogeo
Hi all,
I'm using limesurvey and try to prefill answer by passing arguments in URL.
It is ok with text or date questions types but I'm facing issues when prefilling listbox or checkboxes ....
Could somebody point me the right way to do so ?
Here is my url (displayed at the end of the survey) :
Thanks for your reply,
I'm using limesurvey and try to prefill answer by passing arguments in URL.
It is ok with text or date questions types but I'm facing issues when prefilling listbox or checkboxes ....
Could somebody point me the right way to do so ?
Here is my url (displayed at the end of the survey) :
Code:
http://mydomainname.tld/index.php?r=survey/index&sid=646543&lang=fr&newtest;=Y&e2={INSERTANS:558129X5X40}&e1={INSERTANS:558129X5X41}&e3={INSERTANS:558129X5X58}&e4={INSERTANS:558129X5X54}&e5={INSERTANS:558129X5X59}&calid={SAVEDID}
Thanks for your reply,
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 3 months ago #161962
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 Prefilling answer with listbox / checkboxes questions types
Well, it's impossible for us to answer that without knowing the structure of your survey.
I would use Expression Manager variables instead if INSERTANS.
So, for a select-radio question it might look like this, where the value passed is the answer code to question code Q1 (not the answer text).
And, it would look like this when passing the results of a multiple-choice code Q1, subquestion code SQ001 (the passed value will be "Y" or nothing).
I would use Expression Manager variables instead if INSERTANS.
So, for a select-radio question it might look like this, where the value passed is the answer code to question code Q1 (not the answer text).
Code:
http://example.com?param1=Q1
And, it would look like this when passing the results of a multiple-choice code Q1, subquestion code SQ001 (the passed value will be "Y" or nothing).
Code:
http://example.com?param1=Q1_SQ001
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 3 months ago #161963
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 Prefilling answer with listbox / checkboxes questions types
Having said that, you refer to prefilling but your URL does not look like a valid survey URL anyway.
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: simogeo
The topic has been locked.
- simogeo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
6 years 3 months ago #161974
by simogeo
Interesting (but still it works with INSERTANS).
I also have to say that the new survey I'm passing variables to is not the same I just filled up.
I'll try this tomorrow. (It works passing data on same survey)
Since I don't know which one is checked, that's mean I need to pass all values I guess. I've tried this with no success :
Any clue ?
By the way, could you tell me why is my (previous) URL not valid ?
Thanks again
Replied by simogeo on topic Prefilling answer with listbox / checkboxes questions types
tpartner wrote: Well, it's impossible for us to answer that without knowing the structure of your survey.
I would use Expression Manager variables instead if INSERTANS.
So, for a select-radio question it might look like this, where the value passed is the answer code to question code Q1 (not the answer text).Code:http://example.com?param1=Q1
Interesting (but still it works with INSERTANS).
I also have to say that the new survey I'm passing variables to is not the same I just filled up.
I'll try this tomorrow. (It works passing data on same survey)
tpartner wrote: And, it would look like this when passing the results of a multiple-choice code Q1, subquestion code SQ001 (the passed value will be "Y" or nothing).
Code:http://example.com?param1=Q1_SQ001
Since I don't know which one is checked, that's mean I need to pass all values I guess. I've tried this with no success :
Code:
index.php?r=survey/index&sid=747676&newtest=Y&lang=fr&q2={q2}&q3_SQ001={q3_SQ001}&q3_SQ002={q3_SQ002}&q3_SQ003={q3_SQ003}
Any clue ?
By the way, could you tell me why is my (previous) URL not valid ?
Thanks again
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5070
- Thank you received: 1263
6 years 3 months ago #161978
by jelo
E.g. &newtest;=Y was an eyecatcher. In you second URL you no longer have that ";".
r=survey/index looks strange too. What is r?
INSERTANS works but changes with every copy of the survey (surveyid changes). So it is better to use variables which are unchanged when copying the survey.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Prefilling answer with listbox / checkboxes questions types
Code:
r=survey/index&sid=646543&lang=fr&newtest;=Y
r=survey/index looks strange too. What is r?
INSERTANS works but changes with every copy of the survey (surveyid changes). So it is better to use variables which are unchanged when copying the survey.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- simogeo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
6 years 3 months ago #161990
by simogeo
Replied by simogeo on topic Prefilling answer with listbox / checkboxes questions types
Thanks jelo. The advantage of using variables is now obvious to me ! Prefilling a listbox works perfectly.
Regarding the URL, the semicolon is still there. I just forgot it when typing ... THe URL is now like this :
the 'r=survey' parameter/value is the default way LS works without URL rewriting I guess ...
Testing a bit more , I'm able to prefill checkboxes with the following syntax :
but this is not confortable since it hardcodes SGQA identifier. I've tried the following with no success :
Is there a way to do it without SGQA identifier ? Thanks
Regarding the URL, the semicolon is still there. I just forgot it when typing ... THe URL is now like this :
Code:
index.php?r=survey/index&sid=646543&lang=fr&newtest;=Y&e1={e1}&e2={e2}&e3={e3}&e4={e4}&e5={e5}&calid={calid}
the 'r=survey' parameter/value is the default way LS works without URL rewriting I guess ...
Testing a bit more , I'm able to prefill checkboxes with the following syntax :
Code:
index.php?r=survey/index&sid=747676&newtest=Y&lang=fr&q2={q2}&747676X1X545SQ001={q3_SQ001}&747676X1X545SQ002={q3_SQ002}&747676X1X545SQ003={q3_SQ003}
but this is not confortable since it hardcodes SGQA identifier. I've tried the following with no success :
Code:
index.php?r=survey/index&sid=747676&newtest=Y&lang=fr&q2={q2}&q3SQ001={q3_SQ001}&q3SQ002={q3_SQ002}&q3SQ003={q3_SQ003}
Is there a way to do it without SGQA identifier ? Thanks
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 3 months ago - 6 years 3 months ago #161996
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 Prefilling answer with listbox / checkboxes questions types
It seems to me that you are missing underscores in your variable names.
If this does not work, please provide a SMALL test survey.
Code:
index.php?r=survey/index&sid=747676&newtest=Y&lang=fr&q2={q2}&q3_SQ001={q3_SQ001}&q3_SQ002={q3_SQ002}&q3_SQ003={q3_SQ003}
If this does not work, please provide a SMALL test survey.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 3 months ago by tpartner.
The topic has been locked.
- simogeo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
6 years 3 months ago #161997
by simogeo
Replied by simogeo on topic Prefilling answer with listbox / checkboxes questions types
I tried already but it does not work.
Here is a survey sample !
Thanks for your support
Here is a survey sample !
Thanks for your support
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
6 years 3 months ago #161998
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 Prefilling answer with listbox / checkboxes questions types
I can reproduce the problem and would say that it is a bug. Please report it -
bugs.limesurvey.org/my_view_page.php
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- simogeo
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
6 years 3 months ago #162007
by simogeo
Replied by simogeo on topic Prefilling answer with listbox / checkboxes questions types
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5070
- Thank you received: 1263
6 years 3 months ago #162011
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Prefilling answer with listbox / checkboxes questions types
You entered the MySQL client library version (libmysql - mysqlnd 5.0.12-dev - 20150407) instead of the MySQL version. 5.0 wouldn't work
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.