Welcome, Guest
Username: Password: Remember me

TOPIC: How can I refer to an URL parameter?

How can I refer to an URL parameter? 2 years 8 months ago #74592

  • Zsolt70
  • Zsolt70's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 3
  • Karma: 0
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?
The administrator has disabled public write access.

Re: How can I refer to an URL parameter? 2 years 8 months ago #74595

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
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)limesurvey.org'"
The administrator has disabled public write access.

Re: How can I refer to an URL parameter? 2 years 8 months ago #74597

  • Zsolt70
  • Zsolt70's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 3
  • Karma: 0
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?
The administrator has disabled public write access.

Re: How can I refer to an URL parameter? 2 years 8 months ago #74601

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
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)limesurvey.org'"
The administrator has disabled public write access.

Re: How can I refer to an URL parameter? 2 years 8 months ago #74657

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4270
  • Thank you received: 804
  • Karma: 368
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.111 seconds
Donation Image