The questionnaire builder (section Questions) is the core of the OpenSurvey system. It involves questions, answers and the survey logic.
Objects
There are several basic objects in the questionnaire with the following hierarchy:
Questionnaire > Groups > Pages > Questions > Answers
You can define specific options and settings to each object.
You can add a unique name to each object. This is important if you want to refer the object in conditions, skip logic, answer piping or other functions.
Click on the menu icon to expand the object actions (delete, copy, move, design, settings).
Pages
You can put all your questions on one page or split them into several pages, or use one page for one questions. You can see the list of all your survey pages in the left sidebar of the QUESTION page.
Click on page name to display the page settings with the following attributes.
Page name: unique page name, you can use it as a referral in the skip logic
Display page if the following condition is true: use the condition wizard to create the condition or you can write it directly on your own by our simple scripting.
If condition is false ľ skip to: fill in the Page name to skip on it
Header: text displayed on the top of the page between header and questions
Footer: displayed on the bottom of the page
Randomize questions on the page: you can change question order on the page
Timing:
- submit timing – disable submit button function for specified time period defined in Time out (seconds) field
- answer timing – respondent is not able to answer for specified time period defined in Time out (seconds) field
- autosubmit timing – the page will be automatically submitted after time period specified in Time out (seconds) field
- Time out (seconds): fill in the time period for Timing functions specified in the Timing box above
Actions
- Start action ľ event/s which run before the page is displayed
- End action ľ event/s which run after the page is submitted
Add action: click on it to insert a new action, you can add as many rows you need, to delete row click on x in front of the Action
There are tree different action possibilities you can chose in select box called ACTION:
1. Skip to page: jump to another page, use the
- Condition ľ a trigger for activation the event
- Page – fill in the Page name to skip on it when the condition is true
2. Screen out: it works same as skip to page, but the interview is marked as ôscreen outö status (it means also that the variable status_ID value is 2 in the data file). ôENDö is the common page name used here.
3. Create variable: for advanced skip logic,
- Condition – a trigger for event activation, or let it blank
- Expression – declare the variable scripting; examples: numeric value var=1, string value var=’string value’, var++ var=[var]+1, question value var=[Q1]
Bulk insert: just paste text in a specific format to add multiple actions
- create variable: createvar;condition;expression
- screen out: screenout;condition;screen label
- skip to page: skipto;condition;screen label
Each line represents one action. See examples:
createvar;;variable_name=1
createvar;[Q1]=1;variable_name=1
screenout;[Variable_name]=1 or [Q1]=9;END
skipto;[Q1]=1;Page_name2
Custom Javascript Code: only for advanced users – write your own JS scripts, they are loaded with the page. It can be used for page interactions. You can also influence the content of the page.
Here is an example which replaces https with http in URL on the page:
Question text:
<a id=”externalLink” href=”{http}://www.youlink.com/link.aspx?id=[resp]”>Click here </a>
Custom Javascript Code:
var link = $(“#externalLink”).attr(“href”).replace(“{http}”,”http”); //using jQuery
$(“#externalLink”).attr(“href”,link);
$(“#externalLink”).text(link);
JavaScript on page submit: only for advanced users – write your own JS scripts, they are loaded after the page is submitted.
Scripting and system variables
Scripting is a very powerful way how to influence the behavior of your questionnaire. It can be used in various situations and applied on various objects.
Operators, variables, question values
- =, <>, <, >,arithmetic operators + – * /
- brackets () to hierarchize
- logic operators AND, OR, NOT,
- [variable] means variable or question value
- question values reference corresponds to the variables in data file and depends on the question type:[Q1] single categorical question value, numerical, text question
[Q1_1] radio grid 1st row value, multiple numerical or text first row value
[Q1_1_1] 1st checkbox in grid, 1st row value, 1 column and row value in 3D grid - Booleans [IS:COMPLETE] [IS:SCREENOUT] [IS:QUOTAFULL] on the end page. The system always returns false if you refer it before the end page.
Examples: [Q1]<3, ([variable_name1]>1 and [Q2]=1) or [Q3_2_1]<2
Question properties, functions:
[IS:QuestionName] – test whether question were displayed in questionnaire, true=displayed, false=not displayed
[IS:QuestionName_x] – test whether response were displayed in questionnaire ,true=displayed, false=not displayed
[ANSWER:QuestionName] – (in future will be changed into [LABEL:QuestionName]) contains label of question answer [VALLAB:Question_Name] – contains label of question answer value [VARLAB: Qx] – contains Question Text
[CHANNELID] – returns ID of the current channel
[DATE:format,days from the current day] – returns the server time, identical to the php DATE function. Examples: [DATE:d.m.Y] returns the current date. [DATE:d.m.Y,-1] returns yesterday. [DATE:d.m.,1] returns tomorrow’s date.
[IS:COMPLETE], [IS:SCREENOUT] and [IS:QUOTAFULL] – questionnaire status (works only on the END page)
END page
The END page is the last page of the questionnaire and has several important purposes. If the respondent reach the END page the state_ID system variable gets the value according the channel settings (more in Respondents: Channel). When an interview is interrupted before reaching the END page, state_ID=0 and it is marked as uncompleted.
You can use the variables [IS:COMPLETE], [IS:SCREENOUT] and [IS:QUOTAFULL] if you need to test the status of a questionnaire:
[IS:COMPLETE] returns true for a completed questionnaire, [IS:SCREENOUT] returns true if the respondent is screened out and [IS:QUOTAFULL] returns true if the questionnaire is interrupted due to full quota. Use these variables to customize text or redirect respondents to different URLs. You can also integrate the variables in common conditions, for example [IS:COMPLETE] and [q1]=10. These variables work only on the END page when the final status is clear, it will not work on any other page of the questionnaire.
Question Types
- Standard question types use pre-defined templates (single categorical, multiple, grids, etc.) and built-in functions (randomization, rotation, pipelining, exclusive answers ů).
- Standard types – user templates offer standard functionalities like previous, but with HTML customization
- User-defined question is a completely different question which does not use internal processing methods and every behavior and action must be developed inside the template
Question name is automatically generated by the system. The first question in a new survey gets the name q1, the second question q2 etc. It is possible to change it. The system always increases the question name by one when you create a new question. For instance when you change the question name to Apart1 – the next question you create will be named Apart2 by the system.
Question text – write or paste your question text, then customize it thru our WYSIWYG editor. You can switch the WYSIWYG editor off (Disable Editor) and use html tags in the plain text. Use question wizard to display answers from previous questions, you can also display other part of question like question text, value, variables value etc. See the Scripting chapter for more information. It is possible to add an image or video by Add media/image.
Question type – choose what kind of question you want to create.
Text above the question – additional text placed in front of answer field
Text below the question – additional text placed under answer field
Custom JavaScript Code – write your own Java script syntax to customize question
JavaScript Code on Submit – write your own Java script syntax or function called on the page submit, it is very useful for additional checks
CSS – Cascading Style Sheets change the look and formatting of question or answers
Answer Required – respondent cannot leave the question without answering
Question Show Condition – write your condition to display the question. See Scripting for reference or build it using condition wizard
Here is the list of standard question types and their settings:
Descriptive text
This type does not generate any data, it’s only a question field, no special settings
Text question
Question expects a keyboard input using text box or text area.
Question Subtype:
- classic
- user template
Field Type – choose the text area type (single line, multiline)
Answer mask – write your own regular expression to check written answer, or use predefined expression, just write directly EMAIL into answer mask field (checks whether answer corresponds with email address specifications)
Add exclusive checkbox – select yes to Add special checkbox often used for NA DK NULL answers
Exclusive checkbox label – write your own exclusive checkbox text
Numeric question
very similar to text question, almost settings share with, it accepts only numerical values, there is only single line area (field type not presented),
Min. Value – response cannot be less than minimal value, only number is accepted
Max. Value – response cannot be higher than minimal value, only number is accepted
Answer mask – numeric question has special predefined expression FLOATn – n says how many decimals in response will be accepted example: FLOAT2 means that 1,5 12 or 50,25 is accepted but not the 5,568
Single Categorical
is a closed-end question , where only one choice is allowed.
Question Subtype:
- Classic – radio buttons vertically with labels on the right
- Dropdown list – displays all responses in one drop-down list
- Scale – radio buttons horizontally with labels above
- Scale slider – using graphic feature called slider
- Vertical scale slider – vertically turned scale slider
Buttons – each response is represented by buttons, used also for images
Autosubmit – automatically moves to next page after selecting the choice without clicking on the Submit button
Show responses chosen at question – write the question name you want to show selected responses.
Number of Answers in Column – divided answers into columns, entered number means amount of answers in one column
Row Order – change order of rows in specified order
- not applied ľ row order is same as defined
- follow the master question – when you choose this option, Select Master Question input box appears under the row order input box. The master question name is expected here. Master question’s rows will be followed.
- random order
- sequence with random start
- ascending order
- descending order
Row Answers – write or paste answers, one row means one choice, use HTML tags to customize the look. There is also possibility to add media file using Add Image/Media. After switch to ôadvanced answer settingsö you can change more details:
- Idx ľ row number
- text ľ text of the answer displayed in the questionnaire
- DB value – define your own value independently on Idx, do not forget to use that value in conditions, the system does not change it automatically (typically DK,N/A answers are coded as 99)
- DB label – change label number, mostly the DB label has the same value as DB value
- show condition – write your condition (see Scripting) or build it using the condition wizard to display answer.
- HOT allows you to import conditions for all responses at once, one row of conditions for one answer. Simply paste syntax to Hot Import pop-up and press Import.
- open – adds an input box next to the choice, it creates semi close-ended answer
- open required – system checks whether something is written in open text field when the radio button is chosen
- fixed – shows only if row order is selected. If checked, the row order of this specific answer is not affected and it stays on its position (commonly used for ôOther, DK/Refö answers in the randomized answer list)
Multi Categorical
is a closed-end question , where multiple choices are allowed to select. Its settings are very similar to single categorical question. Auto submit is not available (system does not know how many answers will by chosen by the respondent).
Min. Number of Answers – minimum amount of choices
Max. Number of Answers – maximum amount of choices
Grid
means the table question, it has rows and columns. Rows represent subjects and columns choices or answers.
Grid type – show what kind of input you want in a cells.áCheckbox to create a multi response grid question,áradio to create a single response grid question (the most common grid type) or
input to create table with text input boxes.
Question Subtype
- classic – normal table look used for all grid types
- sequential ľ each subject is displayed on a separate cards and responses are under as buttons, after answering one subject/card (by clicking on buttons) the next card is turned, automatically after one choice if the grid type is radio
- drag and drop – very similar to sequential. Answering is made by moving card on choice button. It’s possible only for the radio grid type.
- grid split into screens – divides the grid by rows on single questions, displayed separately one on one page
Column Answer – responses in radio or checkbox grid type have the same options as single categorical or multi categorical quesstions rows
Column Order – change order of columns, for more info look at row order
3D Grid
a kind of grid where dropdown lists are placed in grid cells, which adds the third dimension. It is represented by Dropdown answer – corresponds to column answer in grid question type and Row answer in categorical question
Dropdown answer order – change order of items in dropdown list, for more info look at row order
Multiple text question
It is based on the text question. Input boxes are placed into one column. Rows work in the same way as in grid – so determine number of input boxes and text before each one.
Question Subtype
- classic
- sequential
Multiple Numeric Question
This question type provides several fields to input numerical values.
User Defined Question
You can create any type of custom question by programming it by yourself. Only for advanced users with HTML/JS/CSS knowledge.
Example of several basic elements
<ITEM1>
<div class=ôwOptionö>
<label for=”[ELEMENT_ID]”>[ROW_LABEL] [ELEMENT]</label>
</div>
</ITEM1>
<ITEM2>
<div class=ôwOptionö>
<label for=”[ELEMENT_ID]”>[ROW_LABEL] [ELEMENT]</label>
</div>
</ITEM2>
<ITEM3>
<div class=ôwOptionö>
<label for=”[ELEMENT_ID]”>[ROW_LABEL] [ELEMENT]</label>
</div>
</ITEM3>
Mask Edit – you can define the input values by using:
- EMAIL (means regex: ^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$)
- FLOATn (means regex : ^-?(0|[1-9][0-9]*)([\.\,][0-9]{0,’.$float_number.’})?$)
- or any valid regular expression
Skip logic & jumping
You can skip to questions or pages based on previous responses. You can do it in two ways:
1st option: go to Page properties of the next question and fill in the condition in “Display page if the following condition is true” e.g. [q1]=1 and insert target page name in the field “If condition is false ľ skip to” e.g. Page_myName .
2nd option: go to Page properties of the current question and add a new End action. Then select the “Skip to Page” type, fill in the condition [q1]=1 and the target page e.g. Page_myName .
Media and files
Use the Insert media button to add a new file. You can use public or private library to pick the file. You can also upload your own files. It will be add to your project folder. PLease if you are uploading several files witht the same name, the ystem will add a postfix _2, _3 etc. to the duplicate files.
How to add a video:
Option 1:
Go to the specific question and disable the visual editor (button Disable editor). Upload your video and choose your settings in the import dialog (controls, autoplay, ID, etc.). The settings will be added to the question text and to Javascript fields. Or you can do it manually in the following way:
<video id=”video1″ controls autoplay loop width=”624″ height=”260″>
<source type=”video/webm” src=”http://www.domain.com/path/to/your/video.webm”>
<source type=”video/mp4″ src=”http://www.domain.com/path/to/your/video.mp4″>
</video>
</div>
You can customize video properties by changing its attributes (autoplay, controls, height. width, loop, muted, poster, preload, src). See more details here.
You can also use the standard video properties in Javascript, for example check if the video has been already ended: var vid = document.getElementById(“video1”); .
There are two sources mentioned in the tag – webm and mp4. This is a common way how to solve different browser support.
Option 2:
Or you can paste any external video player, for example FlowPlayer:
<p>{VIDEO-http://www.domain.com/path/to/your/video.flv*width:500px;height:400px} </p>
<script type=”text/javascript” language=”JavaScript1.2″>
var test=0;
flowplayer(“player”, “http://ivyzkumy.cz//flowplayer/flowplayer-3.1.2.swf”,
{
onFinish: function() { test=1;},
clip: { autoPlay: true, autoBuffering: true },
plugins: { controls: null }
});
And insert the following script to the “Javascript Code on Submit”:
alert(‘You can continue after the end of video.’);
return false;
}
return true;
Modify the address of your video. You can also modify the script according your needs (enable/disable autoplay, add controls, alert text etc.).
Flowplayer is used in this example, but you can use any other web media player.