Question type - Short free text

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

Contents


Short description

This question type collects a single line of text input. S ST.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)


If the map is enabled as a google map, and the question is set to mandatory, the survey user must move the red point, or enter the Lat/Long text box.  The user may not merely rely on the default, and hit the "NEXT" button.  It is recommended that you so advise in the substance of the question text.


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.



Display rows (display_rows)

Description

Sets the number of rows. If the users enters more lines, a scroll bar is displayed. For the question type "Long free text" (default:5) and the question type "Huge free text" (default:30)

Valid values

  • Any positive integer number greater than 0



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)



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



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



Use mapping service (location_mapservice)

This question allows for either a short free text, or a map -- the LimeSurvey model does not intend for both, concurrently.

If the design intends a map, leave the defaultRows blank. Placing a number, here, such as 0,1, etc, removes the map from the generated HTML code, and causes other errors.

If the map is enabled as a google map, and the question is set to mandatory, the survey user must move the red point, or enter the Lat/Long text box. The user may not merely rely on the default, and hit the "NEXT" button. It is recommended that you so advise in the substance of the question text.



IP as default location (location_nodefaultfromip)

Should the default position be set based on the user's IP addres (yes/no)?

For this to work you have to set a valid key in IP Info DB API Key.



Save country (location_country)

Should the country information be stored at the survey results (yes/no)?



Save city (location_city)

Should the city information be stored at the survey results (yes/no)?



Save state (location_state)

Should the state information be stored at the survey results (yes/no)?



Save postal code (location_postal)

Should the postal code be stored at the survey results (yes/no)?



Default position (location_defaultcoordinates)

Here you can set a default position as lat/long string. When the map is loaded, it will center at this position.

Example: 52.1605 9.8438



Zoom level (location_mapzoom)

Set a zoom level for the map. Min=0, Max=11.

Example

This image shows a 500x300 map using zoom level = 5:

Map zoom level.png



Map width (location_mapwidth)

Width of the map in pixels (default: 500px)



Map height (location_mapheight)

height of the map in pixels (default: 300px)



Numbers only (numbers_only)

Description

If you set this option the participant can only enter numbers in the text boxes.

For equation question types this setting indicates that the result will be a number only, not a string. This will guarantee proper calculations/conversion 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): Setting this to "No" will overrule "Show totals for" and "Show grand total" setting and total text boxes will not be displayed.
  3. Equation: Setting this option to "Yes" will force 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 and saved as an empty string in responses table.

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)



The following question types support timers:

Time limit (time_limit)

Description

Setting the time_limit attribute on a question will cause a countdown timer to begin counting down as soon as that question/page is loaded. At the expiry of the countdown timer the question will either automatically move on to the next page, or become read-only.

The timer attributes work best with surveys displayed in "Question by question" mode. It is possible to use them in "Group by group" mode, but with certain restrictions. In "Group by group" mode the default time_limit_action is to "Disable only", meaning that the "Next >>" button is not automatically pressed. Automatically moving on to the next question is disabled in group by group mode unless the group only contains one question.

Valid values

  • Any positive integer number

Example

Set it to 240 to count down from 4 minutes (240 seconds)



Time limit action (time_limit_action)

Description

Sets the action performed when a time_limit has expired. By default the action for a time limit is "Warn and move on", which means the system will give a short warning that the time limit has expired before saving the question and effectively automatically clicking "Next >>". The alternative choices are to:

  • "Move on without warning", which automatically clicks the "Next >>" button after the timer is finished but without any warning message.
  • "Disable only", which disables changes in the question so the participant can't change anything but doesn't automatically click the "Next >>" button.

This setting is only applicable if the general Time limit setting is activated.

Available options

  • Warn and move on (default) = will warn the participant that the time has expired, and then click the next button
  • Move on without warning = will immediately click the next button after the time limit has expired
  • Disable only = will disable the answer after the time limit has expired but not automatically click next

Note regarding group-by-group mode: When in group-by-group mode, the "move on" actions of the timer are replaced with a "disable" action. This is so the timer does not affect other questions on the page.



Time limit disable next (time_limit_disable_next)

Description

Allows disabling the "next" button while a time_limit countdown is occurring. Normally, even if a time limit countdown is occurring, if the participant wants to click next and move on to the next question they can (thus cutting short the time spent on the question). By selecting "Yes" for this attribute, the next button will appear greyed out and will not be available until the countdown timer has finished.

This settings is only applicable if the general Time limit setting is activated.

Available options

  • Yes = The Next button will be disabled until the time limit countdown is complete.
  • No (default)



Time limit disable prev (time_limit_disable_prev)

Description

Allows disabling the "previous" button while a time_limit countdown is occurring. Normally, even if a time limit countdown is occurring, if the participant wants to click 'prev' and move on to the previous question they can (thus cutting short the time spent on the question). By selecting "Yes" for this attribute, the previous button will appear greyed out and will not be available until the countdown timer has finished.

This settings is only applicable if the general Time limit setting is activated.

Available options

  • Yes = The Previous button will be disabled until the time limit countdown is complete.
  • No (default)



Time limit countdown message (time_limit_countdown_message)

Description

This sets the text message that displays in the countdown timer during the countdown. This setting is only applicable if the general Time limit setting is activated.



Time limit timer CSS style (time_limit_timer_style)

Description

Allows (and overrides the default) css styling used to display the countdown timer. The default style value for this attribute will be used if it does not exist, and is: 'width: 150px; margin-left: auto; margin-right: auto; border: 1px solid #111; text-align: center; background-color: #EEE; margin-bottom: 5px; font-size: 8pt;'

Any text entered into this attribute will overwrite the entire default css style, so you should ensure that care is taken when entering a value for this attribute. A simple way to hide this is to copy the default style into this attribute and add 'display: none;' to the end.

This settings is only applicable if the general Time limit setting is activated.

Example



Time limit expiry message display time (time_limit_message_delay)

Description

This attribute sets how many seconds the time_limit_message displays for before the time_limit_action occurs. If this attribute is not set, it defaults to a value of 1 (1 second).

This settings is only applicable if the general Time limit settings is activated.

Example

time_limit_message_delay: 5 = the message displays for 5 seconds



Time limit expiry message (time_limit_message)

Description

This is the text of the message that appears to the participant when the time_limit has expired. By default, this message is "Your time to answer this question has expired". If the time_limit_action attribute is set to "Move on without warning" this message is not displayed. You can set the CSS style for this text in the time_limit_message_style attribute (see below).

This settings is only applicable if the general Time limit settings is activated.

Example

time_limit_message: The time limit on answering this question is now up.



Time limit message CSS style (time_limit_message_style)

Description

Allows (and overrides the default) css styling used to display the time limit message. The default style value for this attribute will be used if it does not exist, and is: 'top: 10px; left: 35%; width: 30%; height: 60px; padding: 16px; border: 8px solid #555; background-color: white; z-index: 1002; text-align: center; overflow: auto'

Any text entered into this attribute will overwrite the entire default css style, so you should ensure that care is taken when entering a value for this attribute. It is strongly recommended that you re-use the z-index value, or that, at least, the z-index value be higher than that used for the time_limit_warning_message_style attribute (which defaults to 1001).

Example

Set to:

top: 10px; left: 35%; width: 30%; height: 60px; padding: 16px; border: 8px solid #555; background-color: black; color: white; z-index: 1010; text-align: center; overflow: auto



Time limit warning message timer (time_limit_warning)

Description

Sets how long (in seconds) before the time limit expires to display the time_limit_warning_message. Setting a value for this attribute turns on the time limit warning message.

This settings is only applicable if the general Time limit settings is activated. This setting also exists for a second warning message.

Example

If you set this to '20' then the time limit warning message will appear 20 seconds before the time limit countdown reaches zero.



Time limit warning message display time (time_limit_warning_display_time)

Description

Sets how long the time_limit_warning_message displays for before it is removed/hidden from the screen. By default if the time_limit_warning_message appears, it will remain visible until the countdown timer has completed the countdown. If a value greater than zero exists in this question attribute, the message will be hidden after that many seconds.

This settings is only applicable if the general Time limit setting is activated. This setting also exists for a second warning message.

Example

time_limit_warning_display_time: 10 = The time limit warning message will dissapear 10 seconds after appearing



Time limit warning message (time_limit_warning_message)

Description

Sets the text of the warning message that displays at a fixed period of time before a time limit expires. By default this text is "Your time to answer this question has nearly expired. You have {TIME} remaining." {TIME} is replaced by a formatted description the amount of time remaining (ie "30 seconds", or "1 minute, 5 seconds"). This message only appears if the time_limit_warning attribute exists. The time_limit_warning attribute sets when this message appears, measured in seconds before the time limit expires.

This question attribute is only applicable if the Time Limit setting is activated and you set some text in the Time limit warning message. This setting also exists for a second warning message.

Example

Attention: In {TIME} the time limit to answer question will expire.



Time limit warning CSS style (time_limit_warning_style)

Description

Allows (and overrides the default) css styling used to display the time limit warning message. The default style value for this attribute will be used if it does not exist, and is: 'top: 10px; left: 35%; width: 30%; height: 60px; padding: 16px; border: 8px solid #555; background-color: white; z-index: 1001; text-align: center; overflow: auto'

Any text entered into this attribute will overwrite the entire default css style for the warning message, so you should ensure that care is taken when entering a value for this attribute. It is strongly recommended that you re-use the z-index value, or that, at least, the z-index value be lower than that used for the time_limit_message_style attribute (which defaults to 1002).

This settings is only applicable if the general Time limit setting is activated. This setting also exists for a second warning message.

Example

top: 10px; left: 35%; width: 30%; height: 60px; padding: 16px; border: 8px solid #555; background-color: gray; color: white; z-index: 1001; text-align: center; overflow: auto



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