Check out the LimeSurvey source code on GitHub!

Passing $_REQUEST data to a prefilled answer field

More
6 years 4 months ago - 6 years 4 months ago #50945 by rofz
Hi everyone.

I would like to use a survey's URL to pass data to a prefilled answer field.

So, what i need exactly is this:

1 - Send to survey users an URL with an additional parameter, such as &ticket_number=123456
2 - Collect this ticket_number=123456 by using php's $_REQUEST array
3 - Make the HTML 'value' parameter of an answer field just exactly as $_REQUEST

All of the above is relatively easy to code on PHP, but the big problem is: questions and survey's are so dynamic in limesurvey that i don't have any clue on which file must be edited to accomplish that third step (change HTML input default value).

Any ideas would be greatly appreciated.

Thanks
Rofz
Last Edit: 6 years 4 months ago by rofz.

Please Log in to join the conversation.

More
6 years 4 months ago #50972 by Mazi
You can pass data to a survey question without editing any code. It works similar to the end URL feature, check docs.limesurvey.org/tiki-index.php?page=...ation_amp_Navigation

If you have a short text question with ID 333 in group ID 22 of survey 12345 you can add this to the survey URL:
...&12345X22X333=<ticketnumber>


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
6 years 4 months ago #51033 by rofz
Hey Mazi. Thanks a lot, it worked like a charm.

Please Log in to join the conversation.

More
6 years 4 months ago #51034 by Mazi
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 11 months ago #57952 by alferx
Hi all.

What if I would pass the value of an answer (I think it an be called a dynamic value pass) to the survey URL?

In example, if 66462X4X3 is the source value of survey 66462 and I want it to pass as my dynamic <ticketnumber>, I should write something like this:

...&12345X22X333={66462X4X1}
or
...&12345X22X333={INSERTANS:66462X4X1}

But as default value of the 12345X22X333 question, I got respectively
66462X4X1
or
Errore(66462X4X1)

Is it possible to pass dynamic values?
Any help appreciated!

Alferx

Please Log in to join the conversation.

More
5 years 11 months ago - 5 years 11 months ago #57957 by DenisChenu
According to the documentation , you have to use {INSERTANS:66462X4X1}.

But if {INSERTANS:66462X4X1} is not set or is empty, then you have Error({INSERTANS:66462X4X1}) becaus to not have :

index.php?myvar={INSERTANS:66462X4X1}&myvar2={INSERTANS:66462X4X2} becoming

index.php?myvar=&myvar2=

:)

PS : you can use the HTML editor to know exactly the SGQA code.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
Last Edit: 5 years 11 months ago by DenisChenu.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form