====== Create a Questionnaire ======

To be able to see the questions in the online questionnaire, you have to **create a questionnaire**. Therefore the building blocks will spread on several sites of the online questionnaire and if required you can also use filters.

{{:de:create:scr.questionnaire.nav.png|create a questionnaire in the navigation}}

You should select the button //create new questionnaires// to create a new questionnaire. It is possible to process it later, if the user selects the description of the questionnaire or the {{:button.edit.gif}}-symbol.

===== The Questionnaire =====

The questionnaire is used to order the building blocks (questions, texts, images, etc.) in the online questionnaire. The content of the questionnaire should be arranged and the questionnaire follows methodical considerations. In the questionnaire you can define several settings, e.g.:

  * the sequence of questions in the online questionnaire
  * division of questionnaires on several sites in the online questionnaire
  * the sequence of questions within a site of the questionnaire
  * the arrangement of the blocks within a page ([[composition|advanced display]])
  * logic of the questionnaire (e.g. [[filters]])

A questionnaire may not include all questions of the questionnaire. Questions, which cannot be displayed as well as possible, cannot be answered from the participant.

**Warning:** It is possible to create several questionnaires in a survey project. This is particularly useful if the questionnaire will be displayed in different variations – e.g. for several target groups or for [[randomization|]] the sequence of questions. If you need different questionnaires with different questions, you should create a further survey project in your **account**.

If there exists several questionnaires, you can choose a specific questionnaire while using the links for the questionnaires (e.g. to welcome employees of company A with another layout than the employees of company B). It is an attempt to choose the variable q in the URL for the code of the questionnaire. Furthermore oFb offers the possibility to select one of the questionnaires by random ([[:de:survey:url|link to questionnaire]]).

===== Assemble Questions =====

Since oFb Version 2.0 the creation of a questionnaire is quite simple: You can push aside the questions.

First of all you also need a questionnaire. When you create a questionnaire it can be found at **create a questionnaire** -> //create a new questionnaire//. The //code// should be kept shortly – it is only visible, if you use more than one questionnaire in the survey project. The same applies to the //desription//: it only serves to differentiate between different versions of the questionnaire.

The layout that is displayed by **questionnaire-layouts** is defined as a standard. If you will use another layout for your questionnaire, it is possible to choose this. If there is no layout activated in the questionnaire-layouts, you can’t choose any in the questionnaire.

The //restricting access// permits to restrict the participants of the questionnaire ([[access|restricting access]]).

You can create the questionnaire with a click on //OK// and you will get the following user interface (the orange box on the left side is actually filled with more text):

{{:de:create:scr.qnrpage.gui.png|working with one page of the questionnaire}}

The settings, which are defined when creating a questionnaire, may change at any time with the tab //settings//. The //control-code// shows a XML-document, which describes a questionnaire. Generally it is not needed.

The actual composition of the questionnaire occurs with the tab //pages in the questionnaire//. On the right side you can find all the elements you have created before in the **questionnaire** and in **headers and texts**. It is however possible to insert photos directly, which you have uploaded under **photos and media files**.

In a new questionnaire you’ll find an empty page. You can use your mouse for dragging elements from the right to the left side.

The //last page// has an exceptional character: questions or other contents cannot be inserted. By clicking the “next” button the answers of the participant will be sent to the server (for saving). After the last klick on “next” button the last page appears on the display. This page doesn’t include a “next” button and therefore it is impossible to include questions.

You can get additional pages by dragging the unruled-page from the top hand right corner (//new page//) to the left side or by using one of the symbols on the right side. The meaning of the symbols (“from top to down”): Insert new page before the actual page, after the actual page and at the end. Besides you can add a //code// and/or a //note//. The //code// is required to jump to a page directly by using the following command [[:de:create:functions:gotopage|goToPage()]] – more information can be found below.

Each change in the questionnaire will be saved at the moment (during the transfer of the changes you will see yellow flashing dots, after then a little green OK appears on the display). By using the arrow keys you can start __the questionnaire directly__ on the current page.

For testing the whole questionnaire you can start at the first page or in the menu under **create a questionnaire**.

===== Delete or Move Questions =====

Questions, text modules, photos, HTML-code and PHP-code (see below) are all elements of one page in the questionnaire.

All elements have a title bar. By clicking at the title bar the elements can be moved (within the page as well as to other pages) or can be deleted if you drag it to the left or to the right side.

{{:de:create:scr.qnrpage.element.remove.png|remove element from the side}}

===== Options for Individual Questions =====

In some cases these elements permit further settings. If you want to link two questions directly without any clearance between, it may not allowed any space below the upper one and no title above the lower one.

You can carry out the setting by clicking on an element of the questionnaire.

{{:de:create:scr.qnrpage.element.edit.png|change the characteristics of an element}}

With the options //showing question text// and //showing description// you can hide a question and a saved explanation for this question. That’s very suitable, if two questions shall be shown under each other or if the items of a question shall be distributed on several sides - 
however, the explanation shall be shown at it only once.

//question-number// is also an option. You can deactivate this option for automatic numbering in the settings of the questionnaire. Furthermore you can deactivate the numbering for individual questions.

Another interesting option is //showing items//. In some special cases you want to display only the question without items  –  often you didn’t want to display all items, just only a part of it. For example, if you want to spread one question over several pages or want to paste subheadings via HTML between the items. You can define with the code of the items which of them should be displayed. A list “1,2,3,4,5” shows e.g. die first five items of a question.

The option //distance to the next question// regulates the free space remaining  under a question before the next question follows This setting is relevant if you want to combine different questions.

===== HTML code =====

Next to the questions you will find the element //HTML-Code//. This option allows to integrate short text- or HTML-fragments in the questionnaire. For example a subheading or a JavaScript.

Designing of texts with HTML s see also [[texts#html_tags|texts in the questionnaire]].

For longer texts you should create a text element (under **description and texts**).

**Warning:** If you prepare text elements or questions in a new browser window they will not appear in the right selection. Therefore you have to load again the page for creating the questionnaire.

===== PHP code =====

The most flexible component in the questionnaire is the PHP-Code (see also [[php|Introduction to PHP code]]).

This component enables complete programming – e.g. filters, automatic item-selection, random numbers, etc. (see [[filters|filter questions and filter]]). With the following link [[functions|PHP-functions]] you can get some information about the functions, which are especially prepared for the questionnaire by oFb.

It is very easy to converte elements of the questionnaire to PHP-Code: You can drag  a PHP-Code on your side then drag individual elements from the side or from the selection on the right side of the PHP-Code-element.

{{:de:create:scr.qnrpage.element.convert.png|converting a element in a PHP-Code}}

**Warning:** It is not possible to reconvert the PHP-Code to an element of the questionnaire!

**Warning:** oFb only permits secure PHP-functions in the PHP-Code to save the security of the server. If you want to use a “forbidden” function for example ''mysql_query()'' – to read out other projects – a warning appears and the PHP-Code will not be executed.
