This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
en:create:inputs-single [21.06.2019 19:40] – Partial Update admin | en:create:inputs-single [22.06.2019 15:29] – Update admin | ||
---|---|---|---|
Line 30: | Line 30: | ||
Create the question ZE01 with //type// "text input" | Create the question ZE01 with //type// "text input" | ||
- | {{:en: | + | {{:de: |
- | Create another question | + | Create another question |
- | {{: | + | {{: |
- | FIXME | + | Now, create the question (ZE03) where the inputs shall be used within. In the above example, this is a "scale (fully labelled)" |
- | 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' | + | {{:de:create: |
- | The first additional input field derives from item 01 of the question | + | Now we have to add placeholders into the question |
- | Therefore add an item to the superior question | + | |
- | {{: | + | The first additional input field derives from item 01 of the question ZE01. The ID of this item is ZE01_01. The placeholder |
- | The preview won't show much for now: the placeholder will simply be highlighted. The input field will show later on in the questionnaire. | + | Other: %input:ZE01_01% |
- | The other input field is a dropdown selection. We don't just need one item but the whole question " | + | {{: |
- | As the preview still won't show much, you need to use php when assembling | + | The other input is a dropdown selection. For this one we do not use a single item, but the whole question ZE02. To do so, add another item to questiom ZE03, using the following |
- | <code php> | + | Other: %input:ZE02% |
- | prepare_input(' | + | |
- | prepare_input(' | + | |
- | question(' | + | |
- | </ | + | |
- | **Tip:** You can simply drag-and-drop the question ZE01 underneath the php-code-field. The one important thing is the question // | + | {{scr.inputs-single.complete.png? |
- | + | ||
- | If you start the questionnaire with the {{: | + | |
- | + | ||
- | {{:en:create:scr.inputs-single.complete2.png? | + | |
====== Optimization ======= | ====== Optimization ======= | ||
- | An open-ended [[selection-textinput|text input in a normal selection question]] automatically selects the appropriate option when the respondent writes something into the text field. When text inputs are placed using `prepare_input()`, they are not automatically associated with the corresponding option. This can be set up using [[: de: create: javascript|JavaScript]]. | + | An open-ended [[selection-textinput|text input in a normal selection question]] automatically selects the appropriate option when the respondent writes something into the text field. When text inputs are placed using placeholders, they are not automatically associated with the corresponding option. This can be set up using [[: |
Line 87: | Line 78: | ||
<code javascript> | <code javascript> | ||
<script type=" | <script type=" | ||
- | QuestionSelect.LinkSelect2Text(" | + | new S2Selection.LinkSelect2Text(" |
- | QuestionSelect.LinkSelect2Text(" | + | new S2Selection.LinkSelect2Text(" |
- | QuestionSelect.LinkSelect2Text(" | + | new S2Selection.LinkSelect2Text(" |
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Selection and Dropdown ==== | ||
+ | |||
+ | You have a dropdown within a selection (placed via placeholder) and the respective selection option shall automatically be selected when the dropdown is used? | ||
+ | |||
+ | This is accomplished by the JavaScript function '' | ||
+ | |||
+ | <code javascript> | ||
+ | <script type=" | ||
+ | new S2Selection.linkOptionToInput(" | ||
</ | </ | ||
</ | </ |