Actions

URL fields/vi: Difference between revisions

From LimeSurvey Manual

(Created page with "==Trường trả lời==")
(Created page with "Bạn cũng có thể sử dụng '''{INSERTANS:SGQA}''' hoặc Biến ExpressionScript. Trường URL này cho phép...")
Line 40: Line 40:




You can also use '''{INSERTANS:SGQA}''' or [[ExpressionScript - Presentation#Qcode_Variable_Naming|ExpressionScript variables]]. This URL field allows you to add the response to a specific question in the survey into the end URL. This can be useful for sending a response to an external script (i.e. an email address collected during the survey).
Bạn cũng có thể sử dụng '''{INSERTANS:SGQA}''' hoặc [[ExpressionScript - Trình bày#Qcode_Variable_Naming|Biến ExpressionScript]]. Trường URL này cho phép bạn thêm câu trả lời cho một câu hỏi cụ thể trong khảo sát vào URL cuối cùng. Điều này có thể hữu ích khi gửi phản hồi tới tập lệnh bên ngoài (tức là địa chỉ email được thu thập trong quá trình khảo sát).


For example:
For example:

Revision as of 08:51, 10 January 2024


Giới thiệu

Bạn có thể sử dụng tham số trường URL trong trường:


Trường URL cuối

Khi kết thúc cuộc khảo sát hoặc khi hạn ngạch khiến cuộc khảo sát chấm dứt, có tùy chọn đặt URL kết thúc. URL này được hiển thị cho người tham gia đã hoàn thành khảo sát ở trang cuối hoặc bạn có thể tùy ý đặt người tham gia được tự động chuyển hướng đến URL tương ứng. Điều này có thể được thực hiện bằng cách điền vào tùy chọn URL cuối cùng từ bảng Thành phần văn bản khảo sát và bằng cách cho phép tải tự động URL cuối cùng từ bảng Trình bày sau khi khảo sát hoàn tất .

Tuy nhiên, LimeSurvey cung cấp khả năng sử dụng các trường URL theo nhiều cách khác, từ đó cho phép bạn nâng cao chức năng khảo sát của mình.


Các trường cơ bản

Bạn có thể sử dụng {SAVEDID}, {TOKEN}, {SID}{LANG} ở cuối URL:

  • SAVEDID là id được gán cho lần gửi cụ thể này;
  • TOKEN là mã thông báo được sử dụng để tham gia khảo sát;
  • SID là ID khảo sát;
  • LANG là mã ngôn ngữ.

Ví dụ:

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


Trường trả lời

Bạn cũng có thể sử dụng {INSERTANS:SGQA} hoặc Biến ExpressionScript. Trường URL này cho phép bạn thêm câu trả lời cho một câu hỏi cụ thể trong khảo sát vào URL cuối cùng. Điều này có thể hữu ích khi gửi phản hồi tới tập lệnh bên ngoài (tức là địa chỉ email được thu thập trong quá trình khảo sát).

For example:

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

It is important to add "newtest/y" to the URL to force a new session whenever your survey participants wants to fill in your survey.

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

In the above scenario, the URL pertains to a survey with ID = 48315, group =2, question=22 and answercodes = 2007 and 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.