Actions

Champs d'URL

From LimeSurvey Manual

Revision as of 15:23, 29 August 2023 by Maren.fritz (talk | contribs) (Created page with "Dans le scénario ci-dessus, l'URL concerne une enquête avec l'ID = 48315, le groupe = 2, la question = 22 et les codes de réponse = 2007 et 2008.")


Présentation

Les paramètres des champs URL peuvent être utilisés dans le champ :


URL de fin

A la fin d'une enquête ou lorsqu'un quota entraîne la fin d'une enquête, il existe la possibilité de définir une URL de fin. Cette URL est présentée au participant qui a terminé l'enquête sur la page de fin ou vous pouvez éventuellement configurer le participant pour qu'il soit automatiquement redirigé vers l'URL correspondante. Cela peut être fait en remplissant l'option URL de fin à partir du panneau Éléments de texte de l'enquête et en activant le chargement automatique de l'URL de fin à partir du panneau Présentation une fois l'enquête terminée.

Mais LimeSurvey offre la possibilité d'utiliser les champs URL de nombreuses autres manières, ce qui vous permet d'améliorer les fonctionnalités de votre enquête.


Champs de base

Vous pouvez utiliser {SAVEDID}, {TOKEN}, {SID} et {LANG} dans l'URL de fin : !N !*SAVEDID est l'identifiant attribué à cette soumission particulière;

  • TOKEN est le jeton utilisé pour participer à l'enquête;
  • SID est l'ID de l'enquête ;
  • LANG est le code de langue.

Par exemple:

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


Champs de réponse

Vous pouvez également utiliser {INSERTANS:SGQA} ou des Variables ExpressionScript. Ce champ URL vous permet d'ajouter la réponse à une question spécifique de l'enquête dans l'URL de fin. Cela peut être utile pour envoyer une réponse à un script externe (c'est-à-dire une adresse e-mail collectée lors de l'enquête).

Par exemple:

https://www.limesurvey.org/test.php?email={EMAILADDRESS}

Il est important d'ajouter « newtest/y » à l'URL pour forcer une nouvelle session chaque fois que les participants à votre enquête souhaitent répondre à votre enquête.

https://exampletest.limequery.com/index.php/survey/index/sid/48315/newtest/Y?48315X2X222007=Y&48315X2X222008=Y

Dans le scénario ci-dessus, l'URL concerne une enquête avec l'ID = 48315, le groupe = 2, la question = 22 et les codes de réponse = 2007 et 2008.

For more details on the necessity of "newtest/y", check the following forum thread.

Expressions

You can also use any expression here.

For example:

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


Passthrough fields

To use passthrough fields, you must define the variable names via panel integration. If you don't assign a target question, the variables will not be saved into responses (read more about the LimeSurvey panel integration feature). To use such a parameter in the end URL, just insert the tag {PASSTHRU:<paramname>} where <paramname> is the name of your input parameter.

Let's suppose that you defined a parameter named "foobar". The survey is started with a link like this one:

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

The XYZ123 is the value you want "to pass".

The end URL of a survey with the following URL https://www.limesurvey.org/test.php?foobarout={PASSTHRU:foobar} would then be converted to https://www.limesurvey.org/test.php?foobarout=XYZ123

Start URL

Prefilling a survey using GET parameters

You can prefill all answers except the upload and equation question type. You can use qcode naming for parameters and set the value for single question types or use the SGQA identifier.

Then, answers 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 prefill the answer.

Here are some start URL examples:

  • http://ls.example.org/1234?QTEXT=prefilled : Fill in the question with code QTEXT with 'prefilled'
  • https://ls.example.org/1234?MULTI_SQ001=prefilled (New in 3.14.1 ) : Fill in the subquestion SQ001 of question with title MULTI with 'prefilled' (for a multiple text question for example).
  • https://ls.example.org/1234?single=-oth-&single_other=Other%20text (New in 3.14.1 ) : Select the "other" answer option of a single choice question and fill in the other value with the text "Other text".
  • https://ls.example.org/1234?1234X1X1SQ001=prefilled : Fill in the subquestion SQ001 of question with ID: 1 from group with ID: 1 with 'prefilled'
  • https://ls.example.org/1234?1234X1X1SQ001=A1 : Preselect the answer option 'A1' of the subquestion SQ001 of question with ID: 1 from group that has ID: 1.
  • https://ls.example.org/1234?1234X1X1SQ001=Y : Preselect the subquestion SQ001 of the question that has the ID 1, from the group that has ID: 1.


 Hint: GET parameters use "?" for the first parameter and "&" for the subsequent ones. If you already have "?" in your URL, you must use "&" to add more GET parameters.


 Hint: The extra GET parameters are only filled in when the survey starts anew. Therefore, 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 panel integration.


Prefilling and hiding the answer

You can use the hidden attribute of a question to hide it from your respondents. If so, the question still remains prefilled.