Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:create:combine [23.11.2020 16:00] – ["Don't Know" for Multiple Scales] sophia.schaueren:create:combine [13.05.2022 18:59] saskia.mueller.577
Line 2: Line 2:
  
 You might want to ask different options about one item. For example the rating of a characteristic and its importance. This is how to implement this. You might want to ask different options about one item. For example the rating of a characteristic and its importance. This is how to implement this.
 +
 +**Note:** Please be sure to also read the notes on mobile devices below.
  
 **Example 1**\\ **Example 1**\\
Line 200: Line 202:
 </script> </script>
 </code> </code>
 +
 +===== Text in the middle =====
 +
 +If you want to place the text between the input fields, you can use the ''combine_items'' parameter to specify in which "column" the labels should be displayed. In the following example they are switched off for the first subquestion (where they are usually active) ''%%'combine_items=no'%%'' and activated for the second subquestion (where they are usually not displayed) using ''%%'combine_items=yes'%%''.
 +
 +{{:en:create:scr.combine.sym-scales.png?nolink|Two scales with text in the middle}}
 +
 +If the two scale questions have the identifiers "SK01" and "SK02", the above representation can be achieved with the following PHP code.
 +
 +<code php>
 +question('SK01', 'combine_items=no', 'combine=SK02', 'combine_items=yes');
 +
 +pageCSS('
 +    table#SK01_tab td.s2col3 {
 +        text-align: center;
 +    }
 +');
 +</code>
 +
 +**Note:** The ''question()'' command simply counts off the ''combine_items'' parameters, it only counts their order, not where they are in the command.
 +
 +**Tip:** As an alternative to the ''combine_items'' parameter, you could also vary the display of the first question so that the input fields are displayed on the left and the labels on the right. This is described in the tutorial [[:en:create:best-worst]].
 +
 +The second part with ''pageCSS()'' ensures that the item texts are displayed centered. The preceding ''table#SK01_tab'' ensures that the CSS statement only applies to the combined question SK01/02. The identifier must, of course, be matched to the identifier of the question. If you don't have any other questions on the page, you can omit this prefix.
  
 ===== Combine Multiple Dropdown-Questions  ===== ===== Combine Multiple Dropdown-Questions  =====
Line 210: Line 236:
  
  
 +===== Mobile devices and responsive display =====
 +
 +A relevant part of the respondants fill in the questionnaire not on an computer but on a mobile device. The most questions in SoSci Survey switch to a different display mode. Therefore in most cases it is enough to try the questionnaire in the end of the implementation on an mobile device. More in the chapter [[:en:create:smartphones]].
 +
 +Combined questions, however, do not automatically adjust the layout to the size of the screen (responsive design) - and therefore may not be completed on mobile devices. Here it is suitable to offer an alternative presentation for mobile devices.
 +
 +First, create a question of the type "Device and request variables". In the questions in the //Device// tab, put a check mark at //Screen size//. After saving you get two variables for the width and height of the screen in pixels. Note the variable identifier for the screen width, which you can find in the //Variables// tab. In the following example it is assumed that the variable has the identifier "GR01_ScW".
 +
 +
 +Now place this question on a page in the questionnaire that comes before the combined question.
 +In the following example it is assumed that the variable has the identifier "GR01_ScW". The screen width (unlike the //Format//, which is often not recognized correctly on Apple devices) is not saved until you click "Next".
 +
 +Now, with a few lines of [[:en:create:php|PHP code]], you can either display the combined question or display the two questions one below the other (and with optimizations for mobile devices). A width of 600 pixels is chosen as the limit here. Depending on the question types and layout, choosing a larger or smaller number may be appropriate.
 +
 +<code php>
 +if (value('GR01_ScW') > 600) {
 +  // combined question
 +  question('AB01','combine=AB02');
 +} else {
 +  // single questions
 +  question('AB01');
 +  question('AB02');
 +}
 +</code>
 +
 +For an explanation of the code, please refer to the [[:en:create:php-filters]] tutorial.
en/create/combine.txt · Last modified: 08.09.2023 11:55 by paul.heineck
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki