Question type - Numerical input

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

Contents


Short description

This question types asks the survey participant to enter a single number.

N Num.jpg


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.



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.

For tip used by LimeSurvey (dynamic), the method use to hide tip is css only, then you can choose another way for hidding it. An exemple to show tip if user submit with error:

.hide-tip .good {display: none;}
.hide-tip .error {display: none;}
.input-error .hide-tip .error {display: block;}

Available options

  • Yes
  • No (default)



Randomization group name (random_group)

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


Description

Place questions into a specified randomization group, all questions included in the specified group will appear in a random order.

Valid values

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



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.



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)



Integer only (num_value_int_only)

Description

Restrict input to integer values

Available options

  • Yes
  • No (default)



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 (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.



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)



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)



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."