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
en:create:inputs-single [22.06.2019 15:29] – Update adminen:create:inputs-single [25.04.2025 19:39] (current) admin
Line 5: Line 5:
 **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 a special placeholder ''​%input:...%'' for that purpose. 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. SoSci Survey 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}}
Line 12: Line 12:
  
 Actually, we merge different questions here. The example above shows a scale (question 1), one item from a text input question (question 2) and a dropdown selection (question 3). Actually, we merge different questions here. The example above shows a scale (question 1), one item from a text input question (question 2) and a dropdown selection (question 3).
- 
-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. 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.
Line 66: Line 64:
 <code javascript> <code javascript>
 <script type="text/javascript"> <script type="text/javascript">
-QuestionSelect.LinkSelect2Text("AU01_12", "TE01_01");+S2Selection.linkOptionToInput("AU01_12", "TE01_01");
 </script> </script>
 </code> </code>
  
-The first parameter in the function `QuestionSelect.LinkSelect2Text()` specifies the HTML ID of the radio button or checkbox, in the example the option with the code 12 in question AU01 (an extended selection that allows multiple choice selection). The second parameter is the HTML identifier of the corresponding text input (here the first input in question TE01)+The first parameter in the function `S2Selection.linkOptionToInput()` specifies the HTML ID of the radio button or checkbox, in the example the option with the code 12 in question AU01 (an extended selection that allows multiple choice selection). The second parameter is the HTML identifier of the corresponding text input (here the first input in question TE01).
- +
-The function `prepare_input ()` (in the PHP code at the top of the page) would have been used in this example for the identifier ''TE01_01''.+
  
 If more than one open-ended inputs are used, you can simply call the function several times: If more than one open-ended inputs are used, you can simply call the function several times:
Line 78: Line 74:
 <code javascript> <code javascript>
 <script type="text/javascript"> <script type="text/javascript">
-new S2Selection.LinkSelect2Text("AU01_12", "TE01_01"); +S2Selection.linkOptionToInput("AU01_12", "TE01_01"); 
-new S2Selection.LinkSelect2Text("AU01_16", "TE01_02"); +S2Selection.linkOptionToInput("AU01_16", "TE01_02"); 
-new S2Selection.LinkSelect2Text("AU01_221", "TE01_03");+S2Selection.linkOptionToInput("AU01_221", "TE01_03");
 </script> </script>
 </code> </code>
Line 89: Line 85:
 You have a dropdown within a selection (placed via placeholder) and the respective selection option shall automatically be selected when the dropdown is used? 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 ''QuestionSelect.linkOptionToInput()''. The first parameter is the ID of the selection option (e.g., ''AB01_02'' for the second option in the selection question AB01). The second parameter is the ID of the dropdown (or of a text input).+This is accomplished by the JavaScript function ''S2Selection.linkOptionToInput()''. The first parameter is the ID of the selection option (e.g., ''AB01_02a'' for the second option in the selection question AB01). The second parameter is the ID of the dropdown (or of a text input).
  
 <code javascript> <code javascript>
 <script type="text/javascript"> <script type="text/javascript">
-new S2Selection.linkOptionToInput("AB01_02", "AB03");+S2Selection.linkOptionToInput("AB01_02a", "AB03");
 </script> </script>
 </code> </code>
en/create/inputs-single.1561210141.txt.gz · Last modified: by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki