Actions

URL fields: Difference between revisions

From LimeSurvey Manual

No edit summary
No edit summary
Line 19: Line 19:


<!--T:6-->
<!--T:6-->
You can use {SAVEDID}, {TOKEN}, {SID} and {LANG} (since 1.71+) in this URL.
You can use {SAVEDID}, {TOKEN}, {SID} and {LANG} in this URL:
* SAVEDID is the id assigned to this particular submission,
*SAVEDID is the id assigned to this particular submission;
* TOKEN is the token used to participate in the survey,
*TOKEN is the token used to participate in the survey;
* SID is the survey ID, and
*SID is the survey ID;
* LANG is the language code
*LANG is the language code.


<!--T:7-->
<!--T:7-->
'''Example'''
For example:


<!--T:8-->
<!--T:8-->
Line 40: Line 40:


<!--T:11-->
<!--T:11-->
'''Example'''
For example:


<!--T:12-->
<!--T:12-->
Line 53: Line 53:


<!--T:15-->
<!--T:15-->
'''Example'''
For example:


<!--T:16-->
<!--T:16-->
Line 84: Line 84:
=Start URL= <!--T:33-->
=Start URL= <!--T:33-->


==Prefilling a survey using GET parameters== <!--T:35-->
==Pre-filling a survey using GET parameters== <!--T:35-->


<!--T:36-->
<!--T:36-->
You can prefill all answer except upload and equation question type. You can use  [[Expression Manager#Access to Variables|qcode naming]]  for the parameters and set the value for single question. For multiple question type, you must use [[SGQA identifier]]
You can pre-fill all answer except upload and equation question type. You can use  [[Expression Manager#Access to Variables|qcode naming]]  for the parameters and set the value for single question. For multiple question type, you must use [[SGQA identifier]]


<!--T:37-->
<!--T:37-->
Then answer are set to the prefilled value, for single choice option, you must use the code of the answer, for multi choice question, you must use Y if you want to check the answer.
Then answer are set to the pre-filled value, for single choice option, you must use the code of the answer, for multi choice question, you must use Y if you want to check the answer.


<!--T:38-->
<!--T:38-->
Line 108: Line 108:


<!--T:42-->
<!--T:42-->
You can prefill, sometimes more easily, answers using URL parameters which can be configure in the [[Survey_settings#Panel_integration|survey settings - panel integration]].
You can prefill, sometimes easier, answers using URL parameters which can be configured in the [[Panel integration|panel integration]].


==Prefilling and hidding the answer== <!--T:43-->
==Pre-filling and hiding the answer== <!--T:43-->


<!--T:44-->
<!--T:44-->
You can use hidden avanced settings to hide the question to respondant. Prefilling is happen too.
You can use hidden advanced settings to hide the question to respondent. Prefilling is happen too.


</translate>
</translate>

Revision as of 20:51, 14 November 2017

URL fields can be used in the general survey exit URL (see the survey texts wiki section), and in the URL setting for each individual quota (see the wiki section about survey quotas).

End URL field

At the end of a survey, or when a quota causes a survey to terminate, there is the option of setting a URL. This URL is presented to the participant who has finished the survey on the completed page, or you can optionally set the participant to be automatically redirected to the URL.

There are a number of fields available to be used to enhance the functionality of this URL.

Basic fields

You can use {SAVEDID}, {TOKEN}, {SID} and {LANG} in this URL:

  • SAVEDID is the id assigned to this particular submission;
  • TOKEN is the token used to participate in the survey;
  • SID is the survey ID;
  • LANG is the language code.

For example:

http://www.limesurvey.org/test.php?var1={SAVEDID}&var2={TOKEN}&var3={SID}&lang={LANG}

Answer fields

You can also use {INSERTANS:SGQA} in this URL (since 1.82+).

  • {INSERTANS: SGQA} allows adding the response to a specific question in the survey to the final url. This can be useful for sending a response to an external script (ie an email address collected during the survey).

For example:

http://www.limesurvey.org/test.php?email={INSERTANS:1234X56X7}

Expressions

You can also use any Expression Manager expression (since 1.92+).

For example:

http://www.limesurvey.org/test.php?gender={if(sex=='Male','M','F')}&name;={name}

Passthrough fields (LimeSurvey 2.x or later)

Starting with version 2.0 you now have to define any additional parameters that should be passed to the end URL in the survey settings (Tab "Panel integration"). To use such a parameter in the end URL just insert the tag {PASSTHRU:<paramname>} where <paramname> is the name of your input parameter.

Example:

You defined in the Panel integration tab a parameter named 'foobar'. The survey is started with a link like

http://example.org/limesurvey/index.php/survey/index/sid/12345/lang/eb?foobar=XYZ123

where XYZ123 is the value you want to pass.

A survey end URL of http://www.limesurvey.org/test.php?foobarout={PASSTHRU:foobar} would then convert to http://www.limesurvey.org/test.php?foobarout=XYZ123

Start URL

Pre-filling a survey using GET parameters

You can pre-fill all answer except upload and equation question type. You can use qcode naming for the parameters and set the value for single question. For multiple question type, you must use SGQA identifier

Then answer are set to the pre-filled value, for single choice option, you must use the code of the answer, for multi choice question, you must use Y if you want to check the answer.

Example

  • http://ls.example.org/1234?QTEXT=prefilled : Fill the question with code Q1 with 'prefilled'
  • http://ls.example.org/1234?1234X1X1SQ001=prefilled : Fill the sub question SQ001 of question number 1 in group 1 with 'prefilled'
  • http://ls.example.org/1234?1234X1X1SQ001=A1 : Check the answer 'A1' at the sub question SQ001 of question number 1 in group 1 .
  • http://ls.example.org/1234?1234X1X1SQ001=Y : Check the sub question SQ001 at question number 1 in group 1.
 Hint: GET parameters use ? for the first and & for subsequent parameters. If you already have ? in your URL, you must use & to add more GET parameters.
 Hint: The extra GET parameters are only filled when the survey starts anew. Therefor, for testing, always add newtest=Y to start a fresh survey. For example: http://ls.example.org/1234?QTEXT=prefilled&newtest=Y


Prefilling a survey using GET parameters using URL parameters tab

You can prefill, sometimes easier, answers using URL parameters which can be configured in the panel integration.

Pre-filling and hiding the answer

You can use hidden advanced settings to hide the question to respondent. Prefilling is happen too.