Questions - introduction
From LimeSurvey Manual
Introduction
Once you 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:
- You may add questions from the survey structure menu;
- Access a question group and look for the quick add question action button;
- Check the Overview tab, and look for the add new question quick button located in the Survey quick actions section.
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: 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 LimeSurvey assessments feature and/or the expression manager.
- 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">
You can also use the HTML WYSIWYG editor, offering a GUI to perform the most important tasks such as using different fonts or sizes, 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 it.
General options
On the right part of the screen, different tabs are displayed. 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 of the various options available;
- Question group: To change the question group of a question, select from the dropdown list the desired group;
- Validation: This feature is available on 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 they can progress;
- Other?: This option appears if you decide to use 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 participants if he or she is not satisfied with the predefined answer options;
- Mandatory?: This setting allows you to require users to answer the question for all question types, before your survey participants 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 conditions for this question. 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 on the Expression Manager manual pages.
Importing a question
Importing a question
You may find on the top of the Add question page a toolbar with different options, one of them being the Import question one:
The following options will be displayed:
- Browse: Select the .lsq file from your server or computer;
- Destination question group: Select the question group you wish to add the imported question to;
- Automatically rename question code if already exists: 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 Expression Manager or when you work with the exported data in R or SPSS (qcode becoming a value label).
- Convert resource links: Used together with the Expression Manager to create advanced question types. If you use them together, complex branching, assessments, validation, and/or tailoring can be done.
To import the question, click on the Import button located on the upper right part of the screen. If succeeded, the question import summary should look like this:
Information from tokens table
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.
The fields available for this are:
{TOKEN:FIRSTNAME} | inserts the value from the "firstname" field in the tokens table |
{TOKEN:LASTNAME} | inserts the value from the "lastname" field in the tokens table |
{TOKEN:EMAIL} | inserts the value from the "email" field in the tokens table |
{TOKEN:ATTRIBUTE_1} | inserts the value from the "attribute_1" field in the tokens table |
{TOKEN:ATTRIBUTE_2} | inserts the value from the "attribute_2" field in the tokens table |
To use this functionality you must type the field text into your question exactly as listed above. Example:
Hello {TOKEN:FIRSTNAME}. We sent an email to you using this address {TOKEN:EMAIL}. Is this correct?
Another example with more customisation, but using JavaScript (please see 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):
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>
?
What do you as a {TOKEN:ATTRIBUTE_1} think about your {if(TOKEN:ATTRIBUTE_1=='worker','bosses','workers')}?
Information from previous answers
There is currently also the capacity to insert the answer of previous questions into the text of an answer:
- 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 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 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.
Styling Questions
It is possible to generally edit the question layout/design with CSS using the template editor.