====== Navigation in the Questionnaire ====== Participants usually start on the first page and then fill out the questionnaire sequentially. The sequence can be changed with ''[[:en:create:functions:setpageorder]]'' or ''[[:en:create:functions:gotopage]]]'', but the participants still follow the sequence given by the project manager. This tutorial describes how to add a menu or navigation to the questionnaire so that participants can jump between pages and/or sections. This is especially useful when using a form in SoSci Survey to get specific information of your participants (see also [[:en:create:mix-forms]]). {{:de:create:scr.navigation.result1.png?nolink|Example for a navigation menu in the questionnaire}} ===== Basics ===== Step one is to fill the IDs on every page which your participants can jump to, under "Compile Questionnaire". Enter the title of your page as //Note//. {{:de:create:scr.navigation.pageid.png?nolink|Enter page ID and note}} The navigation buttons are created by the function ''[[:de:create:functions:buttontopage]]''. This function generates HTML-Code, which can be implemented in the questionnaire page using ''[[:en:create:functions:html]]''. With the following PHP-code you are able to create buttons on a questionnaire page with different purposes. html( '
' buttonToPage('start'). buttonToPage('contact'). buttonToPage('study'). buttonToPage('services'). buttonToPage('documents'). buttonToPage('notes'). buttonToPage('submit'). '
'. );
{{:de:create:scr.navigation.result2.png?nolink|Buttons for navigation between different pages}} The PHP-Code is required on every page (e.g. at the top) of your questionnare to be enabled. This is very inconvenient and makes subsequent changes more difficult. Therefore, you define a new function that manages the navigation and any further adjustments. It is located under **Compile Questionnare** in the tab *PHP Functions*. function navigation() { // Navigation html( '
' buttonToPage('start'). buttonToPage('contact'). buttonToPage('study'). buttonToPage('services'). buttonToPage('documents'). buttonToPage('notes'). buttonToPage('submit'). '
'. ); // Label of the Next button option('nextbutton', 'next form'); }
To enable the function, the following PHP-Code is needed on each page of your questionnare: navigation(); ===== Layout Customization ===== The layout of the page and its buttons can be changed with CSS. First some HTML-Code additions are required: * In the outer ''
'' block element, the ''style'' attribute adds a grey ''border'' at the top and bottom, * around the buttons another ''
'' block element is added with a CSS-class (in the example "NavButtons"). The additional class ''s2flex'' allows to use the whole width. * Between the buttons for "notes" and "send" an empty ''
'' element is added to create some space between the buttons. html( '
'. ''. '
'. );
In the **HTML-Template** you need to add CSS-statements within the ''