Loại câu hỏi - Nhiều văn bản ngắn

From LimeSurvey Manual

This page is a translated version of the page Question type - Multiple short text and the translation is 100% complete.

Mô tả ngắn

Loại câu hỏi này là một biến thể của loại câu hỏi "Văn bản ngắn", cho phép nhiều mục nhập văn bản cho mỗi câu hỏi. Trước tiên, người dùng xác định câu hỏi và sau đó có thể thêm các hộp văn bản bổ sung bằng cách thêm 'Câu trả lời'. Mỗi câu trả lời sẽ trở thành nhãn của hộp văn bản mới.

Ví dụ:

Tùy chọn chung

QS:Bắt buộc

QS:Sự liên quan

Validation (using regular expressions) (preg_validation)


This option lets you specify a regular expression with which you can validate all the parts of a question.

If any question or subquestion value does not meet the validation requirements, the background colour of the text entry field will be changed to red so that users can easily see which parts of the question need to be corrected. Thus, you can do on-page validation. In this way you will not need to wait for the user to click on the submit button to validate the respective question.

Valid values

  • Any valid regular expression


Hiển thị

QS:Tiền tố

QS:Hậu tố

QS:Văn bản input width

QS:Độ rộng cột nhãn

QS:Chủ đề câu hỏi

QS:Ẩn tip

Display rows (display_rows)


It sets the number of rows that are displayed without making use of the scroll bar to check all the content. If there are more rows than the number mentioned in this field, then a scroll bar will be displayed. The default value for the "Long free text" question type is 5, while for the "Huge free text question type" is 30.

Valid values

  • Any positive integer number greater than 0

Random answer order (random_order)


  Deprecated for Answer Options : As of 5.5.0, this attribute is not longer used for ordering answer options. Please see QS:Answer_order

This attribute causes LimeSurvey to ignore the existing order of answer options/subquestions, and instead it orders them randomly. This option permits the survey creator to diminish the survey bias. Please note that if a question has subquestions, the order of subquestions will be randomized, not the order of the answer options.

Available options

  • Yes - Randomize when participant enters survey
  • No (default)

Text input box size (input_box_size)

 Hint: This features is available starting in version 3.0.0


This function allows you to set the size of the text area (the text input box). By default, LimeSurvey forces the input box to be displayed with a default size. This can be overridden by making use of this function.

To move the box on the next line, you need to increase the size of the wrapper. To do so, increase the value of the text input width attribute.

Valid values

  • Any numeric value



Đầu vào

Maximum characters (maximum_chars)


This allows you to set the maximum number of characters that can be entered for a text based question. Entering a value of, say, 20 will mean that the participant cannot enter any more than 20 characters.

Valid values

  • Any integer value above 0

Lý luận

Minimum answers (min_answers)


This function can be used to ensure that a user selects at least a certain number of answers in a multiple choice question.

Valid values

  • Any integer value above 0
  • Any number
  • Any SGQA code
  • Any question code (variable name)
  • Any equation, using ExpressionScript syntax, without surrounding curly braces.


If set to X (a random number), the users can submit the survey form if they select at least X checkboxes. If this option is utilised for ranking questions, this ensures that at least three items are ranked before allowing the respondent to submit the answers/survey.

Please note that if you use this attribute with Ranking questions, you have to set the question to non-mandatory. Otherwise, all the items need to be ranked which is counter-intuitive if you decide to use the min_answers function too.

Maximum answers (max_answers)


It can be used to limit the total number of answers a user can select in a multiple choice question.

Valid values

  • Any number value
  • Any SGQA code
  • Any question code (variable name)
  • Any equation, using ExpressionScript syntax, without surrounding curly braces.


If set to 2, the user will only be able to check at most two checkboxes or one checkbox + fill the "Other" field (if any). For the Ranking question type, the participant would be able to select maximum two items.

QS:Mảng filter exclude

QS:Mảng filter style

QS:Mảng filter

QS:Tùy chọn độc quyền

Randomization group name (random_group)


It places the questions into a specified randomization group, all questions included in the specified group being displayed in a random order to the survey respondents.

You can find a sample survey using randomization group name in ExpressionScript sample survey.

Valid values

Just enter any string you like (for example: 'group1'). All question which have set the same string within the randomization group name box will have their place in the survey randomized (=randomly exchanged among each other).

Preview To preview the questions use the preview survey instead of the preview question group function, as the second has been reported to not show the questions in a randomized order.

Question validation equation (em_validation_q)


This is an equation that is used to validate the entire question (e.g, all of its parts collectively for a multi-answer question). If the question fails the validation criteria, then em_validation_q_tip message will be displayed (it uses the CSS style .error). This tip uses the .em_q_fn_validation CSS style, which is hidden by default within template.css.

The main difference between this feature and the subquestion validation equations (em_validation_sq option) is that for this feature, if the question (or question parts) fail validation, then an error message could be shown. For the subquestion validation, each text entry cell (e.g., in an array question type, but it can also be applied to single entry question types) will be styled so that the background color is (light) red.

Valid values

  • Any equation that makes use of the ExpressionScript syntax, without surrounding curly braces.


  • You want to collect demographic information from users via a multiple short text question, and you want to validate that the user has entered a valid email address and phone number.

This example shows how the question looks with invalid answers:

And here is what it looks like with one invalid answer:

Here is how you edit a question to enter that information:

And here is part of the Show Logic File output that lets you check the accuracy of your expression and ensure that there are no syntax errors:

As you can see, the validation equation tests that both the email and phone number are either empty or match a regular expression filter.

The validation tip only shows the warning message if the phone or email appears invalid.

 Hint: In order to create complex validation messages, read about the usage of the ExpressionScript.

If you wish to import the example from above into your LimeSurvey installation, download the following .lsq file:

 Hint: Remember, LimeSuvey uses the Perl syntax for regular expressions, so they should start and end with / (slash character)!

Tip for whole question validation equation (em_validation_q_tip)


If you are using the question validation equation, you can use this box in order to display an optional message as question tip on how the question has to be filled out.

Valid values


See the example from the question validation equation wiki section- it shows how the tip can be tailored to show which parts of a multiple short text question fail the validation criteria.

Sub-question validation equation (em_validation_sq)


This is an equation that is used to validate each subquestion (text field) individually. Any text field that does not pass these validation conditions will have its background color turned pink (using the .em_sq_fn_validation CSS style) to highlight the error. Note that this is available in addition to the regular expression-based validation option.

Valid values

Any equation that makes use of the ExpressionScript syntax, without surrounding curly braces.


For example, if you want to allow only numbers that are a multiple of 3 as answers, the equation would be:

(this / 3) == floor(this/3)

The reserved variable this is automatically replaced by a reference to the active text entry cell.

Tip for sub-question validation equation (em_validation_sq_tip)


If you are using em_validation_sq, this is an optional message/tip that will be displayed if the introduced answer is incorrect.

Valid values

  • Any string


  • Continuing the example of validating emails, the tip might be "Please enter valid email addresses."


Numbers only (numbers_only)


If you enable this option, the participant can only enter numbers in the text box(es).

For the equation question types, this setting indicates that the result could only be a number, not a string. This will guarantee proper calculations/conversions in follow-up equations regarding the decimal mark.

Behavior by question type

  1. Default: If the subject enters a value that is not a number, that value is immediately cleared from the text box so that the subject can enter an appropriate value.
  2. Array (Texts): If the numbers only option is disabled, the "Show totals for" and "Show grand total" options will be overruled, while the total text boxes will not be displayed.
  3. Equation: Enabling this option will force the equation results to be converted to a numeric value. If the equation result is not a number (and not blank), the equation will return NaN, being saved as an empty string in the response table.

Available options

  • On
  • Off (default)

QS:Ngắt trang

Thống kê

QS:Hiển thị biểu đồ

QS:Loại biểu đồ

Danh mục:Loại câu hỏiDanh mục:Câu hỏi văn bản