How can I refer to an URL parameter?

More
5 years 4 months ago #74592 by Zsolt70
Zsolt70 created the topic: How can I refer to an URL parameter?
If I start the survey with URL like this one:

.../index.php?sid=XXXXX&lang=en&token=YYYYYYY&s1=sometext

How can I refer the value of the parameters got by the URL?
How can I use the value of s1 parameter ("sometext") in the above example in a question text or in a condition?

Please Log in to join the conversation.

More
5 years 4 months ago #74595 by Mazi
Mazi replied the topic: How can I refer to an URL parameter?
You have to use the correct SGQA identifier at the URL to pass data by URL into a question.
There are several examples at the forums, e. g.
www.limesurvey.org/en/forum/can-i-do-thi...a-query-string#74574

www.limesurvey.org/en/forum/can-i-do-thi...a-token-based-survey


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 4 months ago #74597 by Zsolt70
Zsolt70 replied the topic: How can I refer to an URL parameter?
Thank you, but my question is not "how to pass the data", but "how to refer to the data" what I get in the URL.
How can I "pipe" the value of s1 URL parameter in a question text?

Please Log in to join the conversation.

More
5 years 4 months ago #74601 by Mazi
Mazi replied the topic: How can I refer to an URL parameter?
Once you start the survey using such a customized link, the value passed by URL to a certain question will be populated at the question automatically once you get to the question (on page call the passed values is internally stored).
When you click next at the page which holds that question, the passed value will be stored to the database and you can also apply conditions to it.


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 4 months ago #74657 by tpartner
tpartner replied the topic: How can I refer to an URL parameter?
I think Mazi's solution of storing the parameter value in a question for later use in the survey is the easiest/best one.

You can use JavaScript to retrieve the value of a URL parameter but it will normally only be available to you on the welcome screen or the first page of the survey (if the welcome screen is skipped). To have it available later in the survey you will need to use tokens or JavaScript data persistence.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now