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 [18.12.2014 20:51] – admin | en:create:inputs-single [11.12.2017 21:39] – Added JavaScript info admin | ||
---|---|---|---|
Line 62: | Line 62: | ||
{{: | {{: | ||
+ | |||
+ | |||
+ | ====== 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()`, | ||
+ | |||
+ | |||
+ | ===== Extended Selection and Text ==== | ||
+ | |||
+ | For example, if a question of the type " | ||
+ | |||
+ | <code javascript> | ||
+ | <script type=" | ||
+ | QuestionSelect.LinkSelect2Text(" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 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 function `prepare_input ()` (in the PHP code at the top of the page) would have been used in this example for the identifier '' | ||
+ | |||
+ | If more than one open-ended inputs are used, you can simply call the function several times: | ||
+ | |||
+ | <code javascript> | ||
+ | <script type=" | ||
+ | QuestionSelect.LinkSelect2Text(" | ||
+ | QuestionSelect.LinkSelect2Text(" | ||
+ | QuestionSelect.LinkSelect2Text(" | ||
+ | </ | ||
+ | </ |