Question type - Multiple numerical input

From LimeSurvey Manual
Jump to: navigation, search
Other languages:Deutsch 81% • ‎English 100% • ‎español 11% • ‎Nederlands 96% • ‎slovenščina 13%

Contents


Short description

This question type is a variation on the "Numerical input" question type. It allows multiple text boxes to be created each of which can only be answered using numbers. Each text box corresponds to an subquestion, and the subquestion text becomes the label for the input.

K Multi Num.jpg

There are several question attributes which can be used to extend the functionality of this question type. This example uses an advanced setting which checks if the entered numbers match a certain sum.

Download english sample question: K_-_Multiple_Numerical_eq_10.csv

Note: You can use features of the multiple numerical input question type (like slider layout, max_num_value) even if you only have only one item to rate. Instead of adding multiple subquestions just add the one item you need.

The slider layout

By activating the 'Slider layout' setting in the Advanced settings the usual input box is converted into a slider and also can be controlled by various additional advanced settings. The general look of the slider (colors, handle graphic) is determined via CSS which in the default template is defined by the .ui-slider class.

K MN Slider.jpg

Download English sample question: K_-_Multiple_Numerical_eq_10_Slider.csv

Core settings

Mandatory (mandatory)

Description

This option lets you require that all parts of the question be answered. If you have a question with multiple sub-questions, and want to require that some but not all parts be answered, use the min_answers question attribute instead.

Valid values

  • Yes
  • No (default)



Validation (using regular expressions) (preg_validation)

Description

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

If any question or sub-question value does not meet the validation requirements, the background color of the text entry field will be changed to red (New in 1.92 ) so that users can easily see which parts of the question need to be corrected. Thus, you can do on-page validation and do not need to wait for the user to click submit in order to validate the question.

Valid values

  • Any valid regular expression

Example

  • See multiple examples here



Default values (defaults)

Description

This lets you set the default values for some list question type, multiple choice question types and text question type (New in 1.92 ) .


Valid values

  • For single choice questions, you will see drop-down boxes letting you select the desired default.
  • For multi choice questions, you will see check boxs letting you select the desired default state (checked or not-checked).
  • For text-entry questions (New in 1.92 ), you will have a text entry field in which you can enter any string or expression. If you use an expression, you need to include curly braces.

Example

  • You have a non-anonymous survey, where {TOKEN:ATTRIBUTE_1} is the person's age as of the time the tokens table was created. You want to prefill a question with the person's age and ask them to validate that the age is accurate, or let them change the age value if it is not accurate. In the text entry field for the default value, you would enter {TOKEN:ATTRIBUTE_1}

Caution with default value and hidden question

  • If you have hidden question with default value, this default value is set only when the user come to the step of this question. This mean that if whole group his hidden, then no default value is set, or if you are in question by question mode, no default value is set.
  • For hidden question, an alternative solution can be used Expression manager with assignment operator.



Relevance equation

Notice.png
Hint: This features is available starting in version 1.92


Description

If the value of the relevance equation is "1" or "true", the question is "relevant" in the survey context, i.e. it is shown to the survey participant. If not, the question is hidden. All questions let you specify a relevance equation. Relevance is the successor to conditions and supports much more complex conditional logic.

Syntax Highlighting

Whenever you save the relevance equation, it will be evaluated and syntax-highlighted. Any errors will be color coded so that you can quickly detect and fix them.

Valid values

Any equation, using Expression Manager syntax, without surrounding curly braces.

Examples

Here are good examples of syntax highlighting


Advanced settings

Prefix (prefix)

Description

A text value to be shown as prefix before the text input box(es).

Example

Entering a value of "$" for this attribute would result in a dollar sign being displayed immediately preceding the text input box.



Suffix (suffix)

Description

A text value to be suffixed to a text entry box.

Example

Entering a value of "%" for this attribute would result in a percentage sign being displayed immediately after the text input box.



Input box width (text_input_width)

Description

This attribute sets the width of the text input box, but does not limit the number of characters that can be entered.

Example

This is usually stated as the number of characters. So a number of 10 implies that the input field is 10 characters wide.



Random answer order (random_order)

Description

This attribute causes LimeSurvey to ignore the existing order of answer options/subquestions, and instead it orders them randomly. It is important to note that this random order will be reordered each time the question is displayed, so if someone returns to a question, the order will probably be different from the first time they saw it. Having the answers display randomly is useful to remove the possibility of bias from answers to questions. Please note that if a question has subquestions the order of subquestions will be randomized, not the order of the answer options.

Available options

  • Randomize on each page load
  • Off (default)



Hide tip (hide_tip)

Description

Most questions will usually include a tip that says "Please choose one of the following options" or similar hint text how to fill out the question. This attribute allows you to turn off this tips/hints.

Notice.png
Hint: This feature changed with version 1.92
 these tips include the validation criteria messages, (such as min/max number of answers, min/max/equals sum value).  If hide_tip is true, they will be initially hidden; but if the user enters invalid data, the tips will appear, color coded red to indicate the error.  Once the validation criteria are met, the color coding will change to green, but the tips will not disappear.

Available options

  • Yes
  • No (default)



Always hide this question (hidden)

Description

If you prefill a question by URL you can use this setting to hide the question and its value from the survey participant at all. This overrides any conditions because the particular question is never even embedded in a page. If you just want to hide a question (for example if you want to store a value calculated on the fly) then use Javascript embedded in the question source code.

Notice.png
Hint: The question are not diplay in HTML, it can be set with an equation question or survey URL, but not in javascript

Available options

  • On
  • Off (default)



Equals sum value (equals_num_value)

Description

Sets the sum total of all predefined answers that will be accepted. For example: Setting a value of 20 for this attribute would mean that the only acceptable total for all items would be 20. A value of 15 or 60 would be unacceptable.

Valid values

  • Any number value
Notice.png
Hint: This feature changed with version 1.92
  • Any SGQA code
  • Any question code (variable name)
  • Any equation, using Expression Manager syntax, without surrounding curly braces.



Minimum sum value (min_num_value)

Description

Allows you to set the minimum sum total of all predefined answers that will be accepted. The value entered for this attribute becomes the minimum value.

Valid values

  • Any integer value above 0
Notice.png
Hint: This feature changed with version 1.92
  • Any number
  • Any SGQA code
  • Any question code (variable name)
  • Any equation, using Expression Manager syntax, without surrounding curly braces.

Example

Setting a value of 20 for this would mean that the total value of all numbers entered in all input boxes for this question may not be less than 20. Totals of 21 or 50 would be allowed. A total of 15 would not be acceptable.



Maximum sum value (max_num_value)

Description

Allows you to set the maximum sum total of all predefined answers that will be accepted. The value entered for this attribute becomes the maximum value.

Valid values

  • Any integer value above 0
Notice.png
Hint: This feature changed with version 1.92
  • Any number
  • Any SGQA code
  • Any question code (variable name)
  • Any equation, using Expression Manager syntax, without surrounding curly braces.

Example

Setting a value of 20 for this would mean that the total value of all numbers entered in all input boxes for this question may not exceed 20. Totals of 21 would be not allowed. A total of 15 would be acceptable.



Maximum characters (maximum_chars)

Description

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



Minimum value from SGQA (min_num_value_sgqa)

Important.png
Deprecated : This features is deprecated in version 1.92.Use min_num_value instead.

Description

Allows you to set the minimum sum total of all predefined answers that will be accepted. The SGQA identifier value entered for this attribute becomes the minimum value.

Example

You should understand the use of [SGQA identifier]s before using this attribute.

The answer entered for the SGQA identifier for this would mean that the total value of all numbers entered in all input boxes for this question may not be less than that amount. Totals greater or equal than that entered in this question would be allowed. A total of below would not be acceptable.



Maximum value from SGQA (max_num_value_sgqa)

Important.png
Deprecated : This features is deprecated in version 1.92.Use max_num_value instead.

Description

Allows you to set the maximum sum total of all predefined answers that will be accepted. The SGQA value entered for this attribute uses the answer to that SGQA question as the maximum value.

Example

To use this question attribute you should understand the [SGQA identifier]

Setting a particular SGQA identifier for this would mean that the total value of all numbers entered in all input boxes for this question may not exceed whatever answer was made to the SGQA question referred to. Totals above that figure would be not allowed. Totals below that figure would be acceptable.


QS:Num value equals sgqa


Show in public statistics (public_statistics)

Description

This attribute allows the admin to chose if the results of a particular question should be shown to the survey participant after he/she has the submitted he survey. Please note that in general to show statistics to the participant the survey setting 'Public statistics' has to be enabled!

The default setting for each question is 'No' (=Do not show statistics of this question to the user). You have to enable this for every single question if you want to show the survey statistics of that particular question to the participant after the survey submission.

Available options

  • Yes
  • No (default)



Insert page break in printable view (page_break)

Description

This attribute is only active when you actually print a survey from the Printable View. It forces a page break before the question. (Only the Opera browser does not need this since it handles the page breaks accordingly.)

Available options

  • Yes
  • No (default)



Use slider layout (slider_layout)

Description

When set to "On", this question attribute will modify the layout of the Multiple Numerical question type so that it looks like a slider.

Available options

  • On
  • Off (default)



Slider starts at the middle position (slider_middlestart)

Description

The handle is displayed at the middle of the slider (this will not set the initial value).

Available options

  • Yes
  • No (default)



Slider accuracy (slider_accuracy)

Description

When "slider_layout' is set, this question attribute sets the value of step of the slider.

Valid values

  • Any positive floating point number, for example "0.1" or "2"



Slider maximum value (slider_max)

Description

When "slider_layout' is set, this question attribute sets the value of the right-end of the slider.

Example

slider_max 50



Slider left/right text separator (slider_separator)

Description

This question attribute sets the separator used to display text labels on the left and right side of the slider. For example,

Set the slider left/right text separator value to a vertical bar ¦

Then format your subquestions to read:

Subquestion text¦Left slider label¦Right slider label

Example

Slider Left/Right text separator |



Display slider min and max value (slider_showminmax)

Description

Activate this option to display the minimum and maximum value under the slider.

Available options

  • Yes
  • No (default)



Slider minimal value (slider_min)

Description

When "slider_layout' is set, this question attribute sets the value of the left-end of the slider.

Example

slider_min 10



Slider initial value (slider_default)

Description

When 'Slider layout' is set, this sets the initial value of the slider (unless an answer is already recorded for this user's session).

When the Slider initial value is set to a given value, this value will be assumed to be the default answer of the participant, this means that if the question is mandatory and the participant submits the page without moving the slider, it will be assumed that he has answered this default value.

Valid values

  • Any number



Array filter (array_filter)

Description

The Array filter advanced settings allow you to use any multiple choice question to select or set which responses display in a subsequent list, array or multiple choice question.

Starting in 1.92, subsequent questions can be filtered on any array question types, including:
  • Multiple choice
  • Multiple choice with comments
  • Multiple short text
  • Multiple numeric
  • Array (5 point, 10 point, Yes/No/Unknown, Increase/Same/Decrease, Column)
  • Array (Dual Scale, Text, Numbers)
  • Ranking

Furthermore, each of these types of questions can filtered.

The only exception is Array (Column), which can filter other questions, but can not itself be filtered.

To set a filter

Enter the question code of a multiple options question to use as the source information into the setting for array filter. For example, if your source multiple option question code is "Q1" enter "Q1" into either the 'Array Filter' input or the 'Array Filter Exclusion' input in the advanced settings of the question you want to filter. Only answer options that are selected in question Q1 will be visible in the array_filter-ed question.

Starting in 1.92, you can enter multiple array_filter options for a single question, separated by semicolons

Array filter question settings require the questions being used to have exactly matching lists of answers. If the questions do not have exactly the same set of answers and codes, then the filters will break.

Starting in 1.92, if Q2 has sub-questions that are not present in Q1, they will always be displayed rather than breaking the filters.

Cascading

The Array filter will cascade – that is you can select a question which filters another question, which filters another question, and so on.

Array filter example

Ticking items ‘One’, ‘Three’ and ‘Four’ in the first question results in the entries 'One', 'Three' and 'Four' displaying in the subsequent question which uses array filter

Multi option question

Code:Q1

Question: Which animals do you like?

1 Cat

2 Dog

3 Zebra

Array 5 Point Choice Question

Code:Q2

Question: Rate these animals on a scale of 1 to 5, where 1 is I like them a little and 5 is I like them a lot

Array filter example 2 - Using Multiple Short Text

Note: This features is available starting in version 1.92

Array filter with multipe short text.jpg

Here is the Limesurvey Group file for the above demo

limesurvey_group_32.lsg

Array filter example 3 - Cascading Array Filters

This sample survey shows use of array_filter, array_filter_exclude, and exclude_all_others, plus cascading array filters.

ls2_cascading_array_filter.lss



Array exclusion filter (array_filter_exclude)

Description

The Array filter exclusion advanced setting allows you to use a multiple choice question to select or set which responses won't display in a subsequent list, array or multiple choice question.

Starting in 1.92, subsequent questions can be filtered on any array question types, including:
  • Multiple choice
  • Multiple choice with comments
  • Multiple short text
  • Multiple numeric
  • Array (5 point, 10 point, Yes/No/Unknown, Increase/Same/Decrease, Column)
  • Array (Dual Scale, Text, Numbers)
  • Ranking

Furthermore, each of these types of questions can filtered.

The only exception is Array (Column), which can filter other questions, but can not itself be filtered.

To set a filter

Enter the question code of a multiple options question to use as the source information. For example, if your source multiple option question code is "Q1" enter "Q1" into 'Array filter exclusion' input in the advanced settings of the question you want to filter.

Starting in 1.92, you can enter multiple array_filter_exclude options for a single question, separated by semicolons

The source question has to contain exactly the same list of answers/subquestion as the question you wish to filter. Your question will then only display those answers/subquestion that were not selected in the multiple options question.

If the questions do not have exactly the same set of answers/subquestions and codes, then the filters will break.

Starting in 1.92, if Q2 has sub-questions that are not present in Q1, they will always be displayed rather than breaking the filters.

Cascading

The Array filter exclusions settings will cascade – that is you can select a question which filters another question, which filters another question, and so on.

Example

Ticking items 'One' and 'Three' in the first question results in those questions not being displayed in the subsequent question which uses array filter exclusion

Multi Option Question

Code:Q1

Question: Which animals do you like?

1 Cat

2 Dog

3 Zebra

Array 5 Point Choice Question



Minimum answers (min_answers)

Description

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
Notice.png
Hint: This feature changed with version 1.92
  • Any number
  • Any SGQA code
  • Any question code (variable name)
  • Any equation, using Expression Manager syntax, without surrounding curly braces.

Example

If set to 3, the user will only be able to submit the survey form if they have selected at least three check-boxes. In ranking questions, this ensures that at least three items are ranked. Please note that if you use this attribute with Ranking questions please set the question to non-mandatory - because when you leave it at mandatory all items need to be ranked which is counter-active to this feature.



Maximum answers (max_answers)

Description

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 (New in 1.92 )
  • Any question code (variable name) (New in 1.92 )
  • Any equation, using Expression Manager syntax, without surrounding curly braces. (New in 1.92 )

Example

If set to 2, the user will only be able to check at most 2 checkboxes or 1 checkbox + fill the Other field (if any). At ranking questions the participant would be able to only select 2 items at most.



Minimum value (min_num_value_n)

Description

Minimum value of the numeric input

For multiple numeric and numeric array input questions (New in 1.92 ) . When this attribute is set, each input value must meet this criteria.

Valid values

  • Any integer value above 0
  • Any number (New in 1.92 )
  • Any SGQA code (New in 1.92 )
  • Any question code (variable name) (New in 1.92 )
  • Any equation, using Expression Manager syntax, without surrounding curly braces. (New in 1.92 )



Maximum value (max_num_value_n)

Description

Maximum value of the numeric input.

Notice.png
Hint: As of Version 1.92, this also applies to multiple numeric and numeric array input questions. When this attribute is set, each input value must meet this criteria.


Valid values

  • Any integer value above 0
Notice.png
Hint: This feature changed with version 1.92
  • Any number
  • Any SGQA code
  • Any question code (variable name)
  • Any equation, using Expression Manager syntax, without surrounding curly braces.



Whole question validation equation (em_validation_q)

Notice.png
Hint: This features is available starting in version 1.92


Description

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 then em_validation_q_tip message has the CSS style .error set to it. 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 Sub-question 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 sub-question validation, each text entry cell (e.g. in array, but also applies to single entry question types) will be styled so that the background color is pink.

Valid values

Example

    • 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 reasonable email and phone number.

This example shows how the question looks with invalid answers:

Validation-invalid-both.jpg

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

Validation-invalid-phone.jpg

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

Validation-gui.jpg

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

Validation-logic.jpg

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

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

Notice.png
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)

Notice.png
Hint: This features is available starting in version 1.92


Description

If you are using em_validation_q, this is an optional message to show as a question 'tip'.

Valid values

  • Any string

Example

  • See the example for the Question validation tip - it shows how the tip can be tailored to show which parts of a multiple short text question fail validation criteria.



Sub-question validation equation (em_validation_sq)

Notice.png
Hint: This features is available starting in version 1.92


Description

This is an equation that is used to validate each sub-question (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, using Expression Manager syntax, without surrounding curly braces.

Examples

Say you have a multiple short text question and you want to collect email addresses. You could use the regular expression validator to make sure the email address has proper syntax.

As another example, say you only want to allow numbers that are a multiple of 3, 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)

Notice.png
Hint: This features is available starting in version 1.92


Description

If you are using em_validation_sq, this is an optional message to show as a question 'tip'.

Valid values

  • Any string

Example

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



Value range allows missing (value_range_allows_missing)

Note: This features is available starting in version 1.92

Description

This attribute applies to the multiple numerical question type. If Yes, then a user can skip answering the multiple numerical question even if equals_num_value or min_num_value are set.

In early versions of 1.92, the default was "No", so users were forced to enter values if equals_num_value or min_num_value were set.

Current versions of 1.92 use "Yes" as the default.

This option gives authors the option of using the old or new behavior.

Available options

  • Yes (default)
  • No