Actions

URLフィールド

From LimeSurvey Manual

Revision as of 01:11, 22 June 2018 by Bravehorse (talk | contribs) (Created page with "パススルーフィールドを使用するには、アンケート設定で終了URLに渡す必要のある追加パラメータを定義する必要があります(詳...")


はじめに

URLフィールドパラメーターは、以下のケースで使用できます。

終了URL

アンケートの終わり、またはクオータによってアンケートが切断されるときに、終了URLを設定するオプションがあります。このURLは、最終ページでアンケートを終了した参加者に提示されるか、または設定により該当のURLに自動的にリダイレクトされるようにすることができます。利用するには、アンケートテキスト要素パネルで終了URLを入力し、表示パネルでアンケート完了時自動読込URLを有効にします。

ただし、このURLの機能を拡張するために使用できるフィールドがいくつかあります。


基本的なフィールド

URLに{SAVEDID}{TOKEN}{SID}{LANG}を使用できます。

  • SAVEDIDは、アンケートの投稿ごとに割り当てられるIDです。
  • TOKENは、アンケートで使用されたトークンです。
  • SIDは、アンケートIDです。
  • LANGは、言語コードです。

例:

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

回答フィールド

{INSERTANS:SGQA}を使用することもできます。このURLフィールドでは、アンケートの特定の質問に対する回答を終了URLに追加することができます。これは、外部スクリプトに回答(アンケートで収集したメールアドレスなど)を送信する場合に便利です。

例:

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


ただし、URLに"newtest/y"を追加することが重要です。この例を見てください。


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


このURLは、 pertains to a survey with ID = 48315、group =2、question=22、answercodes = 2007 および 2008という回答と関連しています。

(参考: https://www.limesurvey.org/forum/can-i-do-this-with-limesurvey/115371-prefilling-survey-answers-using-the-survey-url-version-3)

式マネージャーの式を使うことまできます。

例:

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

パススルーフィールド

パススルーフィールドを使用するには、アンケート設定で終了URLに渡す必要のある追加パラメータを定義する必要があります(詳細は、LimeSurveyのパネル統合機能を参照)。このパラメータを終了URLで使用するには、{PASSTHRU:<paramname>}タグを挿入します。ここで、<paramname>は入力パラメータの名前です。

Let's suppose that you defined 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

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

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


  Attention : Please note that the passthrough fields can be used only with LimeSurvey 2.x or later!


Start URL

Prefilling a survey using GET parameters

You can prefill all answer except upload and equation question type. You can use qcode naming for the parameters and set the value for single question types. For multiple question type, you must use a 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.

Here are some start URL examples:

  • 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 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 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 the panel integration.


Prefilling and hiding the answer

You can use hidden advanced settings to hide the question from your respondents. If so, the question still remains prefilled.