Actions

Questions - introduction: Difference between revisions

From LimeSurvey Manual

No edit summary
mNo edit summary
(40 intermediate revisions by 4 users not shown)
Line 5: Line 5:




<!--T:31-->
{{Alert|title=Attention|text=Please note that the explanations and screenshots from this wiki section are based on LimeSurvey 3.}}
{{Alert|title=Attention|text=Please note that the explanations and screenshots from this wiki section are based on LimeSurvey 3.}}


Line 10: Line 11:


<!--T:3-->
<!--T:3-->
Once you [[Question groups - introduction#create a question group|created your question groups]], you can start adding questions within each group. There are multiple ways through which you can do that. Three solutions are presented below:
Once you have [[Question groups - introduction#create a question group|created your question groups]], you can start adding questions within each group. There are multiple ways through which you can do that. Two solutions are presented below:


<!--T:32-->
* You may add questions from the [[Survey structure|survey structure menu]];
* You may add questions from the [[Survey structure|survey structure menu]];




<!--T:33-->
<center>[[File:Survey structure - add new question.png]]</center>
<center>[[File:Survey structure - add new question.png]]</center>




* Access a question group and look for the quick ''add question'' action button;
<!--T:34-->
* Access a question group and look for the ''add question'' quick action button;




<!--T:35-->
<center>[[File:Question group - add a new question.png]]</center>
<center>[[File:Question group - add a new question.png]]</center>
* Check the [[Overview]] tab, and look for the add new question quick button located in the ''Survey quick actions'' section.
<center>[[File:Overview - add new question.png]]</center>


=Field descriptions= <!--T:5-->
=Field descriptions= <!--T:5-->


<!--T:4-->
<!--T:4-->
When adding a question, you will be asked about the "Question Code", "Question", and "Help" texts, and the general question options. To change the question group of a question, look in the general options of a question for the question group option and select from the dropdown list the desired group.
When adding a question, you will be asked about the '''question code''', '''question''' and '''help''' texts, and the general question options:




<!--T:38-->
<center>[[File:Add a question - 1.png]]</center>
<center>[[File:Add a question - 1.png]]</center>




*'''Question code:''' Your ID, number or code for the question - used for quick identification. This field is normally not displayed to people taking the survey unless specified in the [[Presentation]] panel - '''Show question number and/or code'''. It is especially useful if you wish to use the [[Assessments|LimeSurvey assessments feature]] and/or the [[Expression Manager|expression manager]].
<!--T:39-->
*'''Question code:''' It represents the ID, number or code for the question that is used for quick identification. This field is normally not displayed to people taking the survey unless specified in the [[Presentation]] panel - '''Show question number and/or code'''. It is especially useful if you wish to use the [[Assessments|LimeSurvey assessments feature]] and/or the [[ExpressionScript - Presentation|ExpressionScript]].


<!--T:6-->
<!--T:6-->
<div class="simplebox">[[File:help.png]] '''Note:''' The question '''code''' must be unique across the same survey, must start with a letter, and can only contain alphanumeric characters. If you ever try to export your data to SPSS or R, you will discover that the "qcode" becomes the value label, so you have to make the code unique. For the time being, LimeSurvey will support legacy code values, but the [[Show Logic File|Show Logic File]] button will color-code such questions so that you know you should change their names.</div>
<div class="simplebox">[[File:help.png]] '''Note:''' The question '''code''' must be unique across the same survey, must start with a letter, and can only contain alphanumeric characters. If you ever try to export your data to SPSS or R, you will discover that the "qcode" becomes the value label, so you have to make the code unique. For the time being, LimeSurvey will support legacy code values, but the [[Show logic file|Show logic file]] button will color-code such questions so that you know you should change their names.</div>
*'''Question:''' This is the actual question being asked. There is no real limit to the length of the question here, however if you want to explain how to fill out the question, leave that for the "Help" field. HTML-code can be used, e.g., for including images:
*'''Question:''' This is the actual question being asked. There is no real limit to the length of the question here, however if you want to explain how to fill out the question, leave that for the "Help" field. HTML-code can be used, e.g., for including images:


<!--T:40-->
<syntaxhighlight lang="html" enclose="pre">       
<syntaxhighlight lang="html" enclose="pre">       
<img src="http://www.yourdomain.com/yourpics/pic.jpg">
<img src="http://www.yourdomain.com/yourpics/pic.jpg">
</syntaxhighlight>
</syntaxhighlight>
<img src="http://www.yourdomain.com/yourpics/pic.jpg"></nowiki>.
The HTML WYSIWYG editor usually helps with the most important tasks, like including images, etc.
*'''Help:''' This is an optional field. It is useful if a question needs some explanation, or you want to explain how it should be answered. When you put text in this field, a "Question Mark" icon appears on the survey entry screens with the help text right beside.


=General options=
<!--T:41-->
<div class="simplebox">[[File:help.png]] '''Hint:''' You can also use the HTML WYSIWYG editor, which offers a GUI to perform the most important tasks such as using different fonts or sizes, including images, etc. To find out more about it, read the following [[First_login_-_your_user_preferences#HTML_editor_mode|wiki section]].</div>
 
<!--T:42-->
*'''Help:''' This is an optional field. It is useful if a question needs some explanation or you want to explain how it should be answered. When you put text in this field, a "question mark" icon appears on the survey entry screens with the help text right beside it.
 
 
<!--T:60-->
<div class="simplebox">[[File:help.png]] '''Note:''' The '''General options''' tab is accessed by default when you wish to add/edit a question (on the right side of the panel). The most important attributes can be found here such as the question type, question theme, as well as the mandatory attribute. However, you can edit further your question by making use of all the other attributes located under the rest of the tabs (see the below screenshot). To find out more about the multitude ways of designing questions in LimeSurvey, please continue reading the following [[Question types|wiki section]].</div>
 


*'''Question type:''' This determines the type of response the survey allows. View the [[Question types]] section for a description of the various options available.
<!--T:61-->
*'''Validation:''' This feature is available on all free text type or numeric questions. You can use standard [[Using regular expressions|Regular Expressions]] in this field to validate the responses to the question, and if the responses don't validate against this expression, the user will be prompted to try again before they can progress.
<center>[[File:Add question - 2.png]]</center>
 
=General options= <!--T:43-->
 
<!--T:44-->
Different tabs are displayed on the right part of the screen. The most basic and important one is the '''General options''' tab. The following question settings can be changed from here:
 
<!--T:45-->
*'''Question type:''' This determines the type of response the survey allows. View the [[Question types|question types]] section for a description on the various available options.
*'''Question group''': To change the question group of a question, select from the dropdown list the desired group.  
*'''Validation:''' This feature is available in all text- and numeric- type questions. You can use standard [[Using regular expressions|regular expressions]] in this field to validate the responses to the question, and if the responses don't validate against this expression, the user will be prompted to try again before he or she can progress further.


<!--T:7-->
<!--T:7-->
*'''Other?:''' Depending upon your chosen 'question type' this option may appear. It allows you to specify that an "other" option be presented in some of the list question types.
*'''Other?:''' This option can be used only with certain question types. If enabled, the question will include as a possible answer an extra "other" option/answer box, which can be selected by the survey participant if he or she is not satisfied with the predefined answer options.
*'''Mandatory?:''' For all question types this setting allows you to require users to answer the question, before they can move on to the next question. For ranking question this means all items have to be ranked.
*'''Mandatory?:''' This setting allows you to require survey participants to answer all the mandatory questions before they can move on to the next question. Note that for ranking question, all items have to be ranked.


<!--T:9-->
<!--T:9-->
*'''Relevance''': This is the Boolean equation that specifies the conditions for this question. If it evaluates to true, the question is show; otherwise it is hidden and since it is irrelevant, data for that question is NULLed in the database. Details about how to use Relevance can be found on the [[Expression Manager|Expression Manager]] pages.
*'''Relevance''': This is the Boolean equation that specifies the question conditions. If it evaluates to true, the question will be displayed to the survey participant; otherwise it is hidden and since it is irrelevant, data for that question is NULLed in the database. Details about how to use this option can be found in the [[ExpressionScript - Presentation|ExpressionScript]] wiki section.


<!--T:8-->
<!--T:8-->
*'''Show advanced question settings:''' The advanced question settings are different for each question type. Please consult the documentation for your particular [[Question types|question type]]
<div class="simplebox">[[File:help.png]] '''Note:''' As it can be observed in the above screenshot, many other options can be used besides the general options tab to customize your question. These more advanced question settings are different for each question type! Therefore, please consult the documentation for your particular [[Question types|question type]].</div>
 


=Importing a question= <!--T:10-->
=Importing a question= <!--T:10-->


<!--T:11-->
<!--T:11-->
At the bottom of the New Question Form you will find a file selection box to import a question file. Here you can import any question file (*.lsq or *.csv (old format)) you previously exported - for example this is useful if you want to reuse a question from another survey.
The following steps demonstrate how to import a question to a survey.  


<!--T:12-->
<!--T:62-->
<div class="simplebox">Important: If you import a question there will always be a new question created. The original question will not be overwritten. If you want to copy a question inside the same survey it is easier to select the existing question and then use the "Copy current question" button.</div>
(1) From within a survey, click the '''Structure''' tab.


(2) From the ''Create question'' page, click '''Import a question''' at the top of the page.


=Information from tokens table= <!--T:13-->
 
<!--T:46-->
[[File:ImportQuestion.png]]
 
 
<!--T:47-->
The ''Import a question'' options will be displayed.
 
 
<!--T:48-->
<center>[[File:Import a question 2.png]]</center>
 
 
<!--T:49-->
(3) Click '''Browse''' and select the .lsq file (which is the LimeSurvey question-type format).
 
<!--T:63-->
(4) Select the '''Destination question group''' that you want to add the imported question to.
 
<!--T:64-->
(5) Choose whether or not you would like to '''Automatically rename the question code if it already exits'''.  If the question code already exists, enable this option to use another question code. You can also have two questions that use the same question code. However, some issues might appear if you use more complex LimeSurvey options such as the [[ExpressionScript - Presentation|ExpressionScript]] or when you work with the exported data in R or SPSS (qcode becoming a value label).
 
<!--T:50-->
<div class="simplebox">[[File:help.png]] '''Hint:''' To check if the question codes are unique across your survey, use the [[Show logic file]] LimeSurvey function to highlight the similar question codes.</div>
 
<!--T:51-->
(6) Choose whether or not to '''Convert resource links'''.  This option is usually used together with the  [[ExpressionScript - Presentation|ExpressionScript]]  to create advanced question types. If you use them together, complex branching, assessments, validation, and/or tailoring can be done.
 
<!--T:65-->
(7) Click '''Import''' located on the upper right part of the screen.
 
 
<!--T:52-->
The ''Question import summary'' will be displayed.
 
 
<!--T:53-->
<center>[[File:Import a question 3.png]]</center>
 
=Information from survey participants table= <!--T:13-->
 
<!--T:54-->
<div class="simplebox">[[File:help.png]] Please note that the token tables are called now survey participants tables.</div>


<!--T:14-->
<!--T:14-->
You can insert information/text from the tokens table into your question so that it can show context related information. For LimeSurvey to do this, the survey needs to be set as NOT Anonymous (ie: tracked), and it needs to have a tokens table.<br /><br />The fields available for this are:<br />
You can insert information or text from the survey participants table into your question so that it can show context related information. For LimeSurvey to do this, the survey needs to be set as [[Participant settings#Participant settings panel|not anonymous]] (i.e: tracked) and it needs to have a [[Survey participants|survey participants table]] created.
 
<!--T:55-->
The following placeholders can be used within a question:


<!--T:15-->
<!--T:15-->
{|
{|
|{TOKEN:FIRSTNAME}||inserts the value from the "firstname" field in the tokens table
|{TOKEN:FIRSTNAME}||inserts the value from the "firstname" field located in the survey participants table
|-
|-
|{TOKEN:LASTNAME}||inserts the value from the "lastname" field in the tokens table
|{TOKEN:LASTNAME}||inserts the value from the "lastname" field located in the survey participants table
|-
|-
|{TOKEN:EMAIL}||inserts the value from the "email" field in the tokens table
|{TOKEN:EMAIL}||inserts the value from the "email" field located in the survey participants table
|-
|-
|{TOKEN:ATTRIBUTE_1}||inserts the value from the "attribute_1" field in the tokens table
|{TOKEN:ATTRIBUTE_1}||inserts the value from the "attribute_1" field located in the survey participants table
|-
|-
|{TOKEN:ATTRIBUTE_2}||inserts the value from the "attribute_2" field in the tokens table
|{TOKEN:ATTRIBUTE_2}||inserts the value from the "attribute_2" field located in the survey participants table
|}
|}


<!--T:16-->
<!--T:16-->
To use this functionality you must type the field text into your question exactly as listed above.  
To use any of the placeholders from above, you must type it/them as written above in the question field text. For example:  
Example:


<!--T:17-->
<!--T:17-->
Hello {TOKEN:FIRSTNAME}. We sent an email to you using this address {TOKEN:EMAIL}. Is this correct?
''Hello {TOKEN:FIRSTNAME}. We sent an email to you using this address {TOKEN:EMAIL}.''
 
 
<!--T:59-->
<syntaxhighlight lang="php" enclose="pre">
 
 
<!--T:56-->
If you wish to further customize your questions, use the [[ExpressionScript - Presentation|ExpressionScript]]. For example, if you wish to make use of the tailoring technique, type in:
 
<!--T:23-->
<syntaxhighlight lang="php" enclose="div">What do you as a {TOKEN:ATTRIBUTE_1} think about your {if(TOKEN:ATTRIBUTE_1=='worker','bosses','workers')}?</syntaxhighlight>
 
<!--T:57-->
<hr width="50%" style="margin:auto">


<!--T:18-->
<!--T:18-->
Another example with more customisation, but using JavaScript (please see [[Optional settings |Optional settings]] on how to allow JavaScript when setting up questions and why it's not always a good idea. To use JavaScript you will need to deactivate the XSS filter in the [[Global settings]]):
You may also use JavaScript to achieve further question customization. First, you have to allow JavaScript to be used when setting up questions. This can be achieved by deactivating the XSS filter from the [[Global settings|global settings]] of your LimeSurvey installation. However, deactivating this option is not always a good idea - read the following [[Optional settings|wiki section]] for further information. Question tailoring via JavaScript:


<!--T:21-->
<!--T:21-->
Line 120: Line 194:
</syntaxhighlight>
</syntaxhighlight>


=Information from previous answers= <!--T:24-->


<!--T:22-->
<!--T:25-->
<div class="simplebox">Starting in Version 1.92, you can use [[Expression Manager|Expression Manager]] to do such tailoring without needing JavaScript. The equivalent in Version 1.92 is the following:</div>
LimeSurvey allows survey administrators to insert an answer(s) from the previous question(s) into the text of a question:
*You can refer to answers on the same page and even dynamically update tailored messages as responses change on the page.
*You can use question code naming - for more details, see the [[ExpressionScript - Presentation|ExpressionScript]] documentation.




<!--T:23-->
<!--T:27-->
<syntaxhighlight lang="php" enclose="div">What do you as a {TOKEN:ATTRIBUTE_1} think about your {if(TOKEN:ATTRIBUTE_1=='worker','bosses','workers')}?</syntaxhighlight>
A wizard has been integrated in the WYSIWYG HTML editor (FCKeditor), so that you can easily insert previous question/answer codes. This plugin is called ''LimeReplacementFields''.
 
 
<!--T:66-->
In order to use this feature in the FCKeditor:
 
<!--T:67-->
(1) Click the "lime between brackets" icon.


<!--T:68-->
(2) Select a question from the select box.


=Information from previous answers= <!--T:24-->


<!--T:25-->
<!--T:58-->
There is currently also the capacity to insert the answer of previous questions into the text of an answer:
<center>[[File:Editor_replacementfields_button.png]]</center>
*You can refer to answers on the same page, and even dynamically update tailored messages as responses change on the page.
*You can use question code naming - for more details, see the [[Expression Manager|Expression Manager]] documentation</div>


<!--T:27-->
A wizard has been integrated in the WYSIWYG HTML editor (FCKeditor), so that you can easily insert previous question/answer codes: this plugin is called the LimeReplacementFields. In order to use this feature, in the FCKeditor, click on the "lime between brackets" icon, and select a question from the select box. Only answers from previous pages are displayed.


[[File:Editor_replacementfields_button.png]]
<!--T:69-->
Only answers from previous pages are displayed.


<!--T:28-->
<!--T:28-->
<div class="simplebox">LimeReplacementFields notice: when you want to delete a reference to a {name} tag, please select all chars from the openning bracket to the closing bracket and press delete: DO NOT erase it char by char with the Delete or Backspace key otherwise the field will appear again.</div>
<div class="simplebox">[[File:help.png]] '''LimeReplacementFields notice:''' When you want to delete a reference to a {name} tag, please select all characters from the opening bracket to the closing bracket and press delete: DO NOT erase it character by character with the delete or backspace key, otherwise the field will appear again.</div>
 


=Styling Questions= <!--T:29-->
=Styling questions= <!--T:29-->


<!--T:30-->
<!--T:30-->
It is possible to generally edit the question layout/design with CSS using [[The template editor|the template editor]].
It is possible to edit the question layout/design with CSS using [[Theme editor|the theme editor]].


</translate>
</translate>

Revision as of 13:32, 12 July 2021


  Attention : Please note that the explanations and screenshots from this wiki section are based on LimeSurvey 3.


Introduction

Once you have created your question groups, you can start adding questions within each group. There are multiple ways through which you can do that. Two solutions are presented below:



  • Access a question group and look for the add question quick action button;


Field descriptions

When adding a question, you will be asked about the question code, question and help texts, and the general question options:



  • Question code: It represents the ID, number or code for the question that is used for quick identification. This field is normally not displayed to people taking the survey unless specified in the Presentation panel - Show question number and/or code. It is especially useful if you wish to use the LimeSurvey assessments feature and/or the ExpressionScript.
Note: The question code must be unique across the same survey, must start with a letter, and can only contain alphanumeric characters. If you ever try to export your data to SPSS or R, you will discover that the "qcode" becomes the value label, so you have to make the code unique. For the time being, LimeSurvey will support legacy code values, but the Show logic file button will color-code such questions so that you know you should change their names.
  • Question: This is the actual question being asked. There is no real limit to the length of the question here, however if you want to explain how to fill out the question, leave that for the "Help" field. HTML-code can be used, e.g., for including images:
       
<img src="http://www.yourdomain.com/yourpics/pic.jpg">
Hint: You can also use the HTML WYSIWYG editor, which offers a GUI to perform the most important tasks such as using different fonts or sizes, including images, etc. To find out more about it, read the following wiki section.
  • Help: This is an optional field. It is useful if a question needs some explanation or you want to explain how it should be answered. When you put text in this field, a "question mark" icon appears on the survey entry screens with the help text right beside it.


Note: The General options tab is accessed by default when you wish to add/edit a question (on the right side of the panel). The most important attributes can be found here such as the question type, question theme, as well as the mandatory attribute. However, you can edit further your question by making use of all the other attributes located under the rest of the tabs (see the below screenshot). To find out more about the multitude ways of designing questions in LimeSurvey, please continue reading the following wiki section.


General options

Different tabs are displayed on the right part of the screen. The most basic and important one is the General options tab. The following question settings can be changed from here:

  • Question type: This determines the type of response the survey allows. View the question types section for a description on the various available options.
  • Question group: To change the question group of a question, select from the dropdown list the desired group.
  • Validation: This feature is available in all text- and numeric- type questions. You can use standard regular expressions in this field to validate the responses to the question, and if the responses don't validate against this expression, the user will be prompted to try again before he or she can progress further.
  • Other?: This option can be used only with certain question types. If enabled, the question will include as a possible answer an extra "other" option/answer box, which can be selected by the survey participant if he or she is not satisfied with the predefined answer options.
  • Mandatory?: This setting allows you to require survey participants to answer all the mandatory questions before they can move on to the next question. Note that for ranking question, all items have to be ranked.
  • Relevance: This is the Boolean equation that specifies the question conditions. If it evaluates to true, the question will be displayed to the survey participant; otherwise it is hidden and since it is irrelevant, data for that question is NULLed in the database. Details about how to use this option can be found in the ExpressionScript wiki section.
Note: As it can be observed in the above screenshot, many other options can be used besides the general options tab to customize your question. These more advanced question settings are different for each question type! Therefore, please consult the documentation for your particular question type.

Importing a question

The following steps demonstrate how to import a question to a survey.

(1) From within a survey, click the Structure tab.

(2) From the Create question page, click Import a question at the top of the page.



The Import a question options will be displayed.



(3) Click Browse and select the .lsq file (which is the LimeSurvey question-type format).

(4) Select the Destination question group that you want to add the imported question to.

(5) Choose whether or not you would like to Automatically rename the question code if it already exits. If the question code already exists, enable this option to use another question code. You can also have two questions that use the same question code. However, some issues might appear if you use more complex LimeSurvey options such as the ExpressionScript or when you work with the exported data in R or SPSS (qcode becoming a value label).

Hint: To check if the question codes are unique across your survey, use the Show logic file LimeSurvey function to highlight the similar question codes.

(6) Choose whether or not to Convert resource links. This option is usually used together with the ExpressionScript to create advanced question types. If you use them together, complex branching, assessments, validation, and/or tailoring can be done.

(7) Click Import located on the upper right part of the screen.


The Question import summary will be displayed.


Information from survey participants table

Please note that the token tables are called now survey participants tables.

You can insert information or text from the survey participants table into your question so that it can show context related information. For LimeSurvey to do this, the survey needs to be set as not anonymous (i.e: tracked) and it needs to have a survey participants table created.

The following placeholders can be used within a question:

{TOKEN:FIRSTNAME} inserts the value from the "firstname" field located in the survey participants table
{TOKEN:LASTNAME} inserts the value from the "lastname" field located in the survey participants table
{TOKEN:EMAIL} inserts the value from the "email" field located in the survey participants table
{TOKEN:ATTRIBUTE_1} inserts the value from the "attribute_1" field located in the survey participants table
{TOKEN:ATTRIBUTE_2} inserts the value from the "attribute_2" field located in the survey participants table

To use any of the placeholders from above, you must type it/them as written above in the question field text. For example:

Hello {TOKEN:FIRSTNAME}. We sent an email to you using this address {TOKEN:EMAIL}.


If you wish to further customize your questions, use the [[ExpressionScript - Presentation|ExpressionScript]]. For example, if you wish to make use of the tailoring technique, type in:

<syntaxhighlight lang="php" enclose="div">What do you as a {TOKEN:ATTRIBUTE_1} think about your {if(TOKEN:ATTRIBUTE_1=='worker','bosses','workers')}?

You may also use JavaScript to achieve further question customization. First, you have to allow JavaScript to be used when setting up questions. This can be achieved by deactivating the XSS filter from the global settings of your LimeSurvey installation. However, deactivating this option is not always a good idea - read the following wiki section for further information. Question tailoring via JavaScript:

Hello {TOKEN:FIRSTNAME}. We sent an email to you using this address {TOKEN:EMAIL}. Is this correct?
What do you as a {TOKEN:ATTRIBUTE_1} think about your
<script type="text/javascript" language="Javascript">;
   var job='{TOKEN:ATTRIBUTE_1}';
   if (job=='worker') {
      document.write ('bosses')
   } else {
      document.write('workers')
   }
</script>
?

Information from previous answers

LimeSurvey allows survey administrators to insert an answer(s) from the previous question(s) into the text of a question:

  • You can refer to answers on the same page and even dynamically update tailored messages as responses change on the page.
  • You can use question code naming - for more details, see the ExpressionScript documentation.


A wizard has been integrated in the WYSIWYG HTML editor (FCKeditor), so that you can easily insert previous question/answer codes. This plugin is called LimeReplacementFields.


In order to use this feature in the FCKeditor:

(1) Click the "lime between brackets" icon.

(2) Select a question from the select box.



Only answers from previous pages are displayed.

LimeReplacementFields notice: When you want to delete a reference to a {name} tag, please select all characters from the opening bracket to the closing bracket and press delete: DO NOT erase it character by character with the delete or backspace key, otherwise the field will appear again.

Styling questions

It is possible to edit the question layout/design with CSS using the theme editor.