|
|
Line 1: |
Line 1: |
− | [[Category:Questionnaire]] | + | [[Category:Archive]] |
− | | |
− | I have an "Age" question, with type number like this:
| |
− | | |
− | [[File:2018-11-19_16-17-00.png]]
| |
− | | |
− | Then I want to convert these number into some groups of age, such as:
| |
− | | |
− | *Under 40
| |
− | | |
− | *[40-49]
| |
− | | |
− | *[50-59]
| |
− | | |
− | *[60-69]
| |
− | | |
− | *70 and Over
| |
− | | |
− | <b>How to do by javascript?</b>
| |
− | | |
− | - First, create a single question "D_AgeGroup" right after "Age" question, with such options:
| |
− | [[File:2018-11-21_8-51-46.png]]
| |
− | | |
− | | |
− | - Second, create a page question type multiple questions per page:
| |
− | [[File:2018-11-22_9-37-06.png]]
| |
− | | |
− | | |
− | - And then add "Age", "D_AgeGroup" to that multi page:
| |
− | [[File:2018-11-22_9-41-05.png]]
| |
− | | |
− | | |
− | - After that, at "Age" question, go to CSS tab to hide "D_AgeGroup"
| |
− | [[File:2018-11-22_9-44-00.png]]
| |
− | | |
− | | |
− | - Finally, also at "Age" question go to Javascript tab, write script for setting value of "D_AgeGroup" from "Age"
| |
− | [[File:2018-11-22_9-47-49.png]]
| |
− | | |
− | | |
− | You are done.
| |
− | | |
− | Viewer only show question of Age. When inputing value on Age question, the approriate value will also set to D_AgeGroup:
| |
− | | |
− | [[File:2018-11-22_9-50-46.png]]
| |