Both sides previous revisionPrevious revision | Next revisionBoth sides next revision |
en:create:inputs-single [11.12.2017 21:39] – Added JavaScript info admin | en:create:inputs-single [21.06.2019 19:40] – Partial Update admin |
---|
**Important:** The question types "selection" and "multiple choice" provide this function by simply checking a box. See [[selection-textinput|Free text inputs within a selection]] how to do this. | **Important:** The question types "selection" and "multiple choice" provide this function by simply checking a box. See [[selection-textinput|Free text inputs within a selection]] how to do this. |
| |
How to achieve a similar output with scales and other question types and how to provide a dropdown selection inside another question is described here. SoSciSurvey provides the PHP-function ''[[:en:create:functions:prepare_input|prepare_input()]]'' to achieve this. We will guide you through using this function using the following example. | How to achieve a similar output with scales and other question types and how to provide a dropdown selection inside another question is described here. SoSciSurvey provides a special placeholder ''%input:...%'' for that purpose. We will guide you through using this function using the following example. |
| |
{{:en:create:scr.inputs-single.complete.png?nolink|Example for freely placed input fields}} | {{:en:create:scr.inputs-single.complete.png?nolink|Example for freely placed input fields}} |
| |
Technically, the input field that is to be added has to be prepared with ''prepare_input()''. In order to place the input field correctly, SoSciSurvey needs a placedholder amongst the original question's items. See further down for details. | Technically, the input field that is to be added has to be prepared with ''prepare_input()''. In order to place the input field correctly, SoSciSurvey needs a placedholder amongst the original question's items. See further down for details. |
| |
| First, the inputs to be used have to be created in the **list of questions**. That means you create a new question, for example a text input question. Second, a placeholder is created, consisting of ''%input:'', the ID of the question or item to be used (e.g., the ID of the text input field that you have just created), and finished by a ''%''. Insert this palceholder whereever the input shall appear. |
| |
**Tip:** Not every question type is available as independent input fields. | **Tip:** Not every question type is available as independent input fields. |
Create a new section with the //ID// "ZE", and the //Name// e.g. "Freely placed input fields". | Create a new section with the //ID// "ZE", and the //Name// e.g. "Freely placed input fields". |
| |
Create the superior question (ZE01) that will contain the input fields. The example above uses the //type// "Scale (extremes labeled)". | Create the question ZE01 with //type// "text input". In this question, an item is added automatically, having the ID ZE01_01. For text inputs, it is useful to set their width -- in this example 120 pixels. The item text will not show up, later. However set one, because it will be used for the variable lable in the data set. |
| |
{{:en:create:scr.inputs-single.outer_incomplete.png?nolink|Example for freely placed input fields - superior question}} | |
| |
Create another question ZE02 with the //type// "Text input". Add one item. It is advisable to add a field width -- This example uses 100 pixels. | |
There is no need to add neither a question nor a "text in front of the input field" although the "text in front" will be used as a variable label in the data export file. | |
| |
{{:en:create:scr.inputs-single.inner2.png?nolink|Text input field that is to be placed freely}} | {{:en:create:scr.inputs-single.inner2.png?nolink|Text input field that is to be placed freely}} |
| |
Create the third question ZE03 with the //type// "dropdown" with three choice options. | Create another question ZE03 with the //type// "dropdown" with three choice options. |
| |
{{:en:create:scr.inputs-single.inner3.png?nolink|Dropdown field that is to be placed freely}} | {{:en:create:scr.inputs-single.inner3.png?nolink|Dropdown field that is to be placed freely}} |
| |
| FIXME |
| |
Now we have to add placeholders into the superior question ZE01 (For more options, see [[placeholders|placeholders in questions and items]]. To do so, we add two items with the text "other:" to the superior question's items and add the placeholder: | Now we have to add placeholders into the superior question ZE01 (For more options, see [[placeholders|placeholders in questions and items]]. To do so, we add two items with the text "other:" to the superior question's items and add the placeholder: |
| |
The first additional input field derives from item 01 of the question ZE02. The ID of this item is ZE02_01. Use this ID as a placeholder and add percent symbols to it: ''%ZE02_01%''. | The first additional input field derives from item 01 of the question ZE02. The ID of this item is ZE02_01. Use this ID as a placeholder and add percent symbols to it: ''%ZE02_01%''. |
Therefore add an item to the superior question containing the //item text//: "other: %ZE02_01%" | Therefore add an item to the superior question containing the //item text//: "other: %ZE02_01%" |