How to set value for a dummy question by javascript

From Catglobe Wiki
Revision as of 04:03, 22 November 2018 by Administrator (talk | contribs) (Created page with "Category:Questionnaire 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 ag...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


I have an "Age" question, with type number like this:

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

How to do by javascript?

- First, create a single question "D_AgeGroup" right after "Age" question, with such options: 2018-11-21 8-51-46.png


- Second, create a page question type multiple questions per page: 2018-11-22 9-37-06.png


- And then add "Age", "D_AgeGroup" to that multi page: 2018-11-22 9-41-05.png


- After that, at "Age" question, go to CSS tab to hide "D_AgeGroup" 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" 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:

2018-11-22 9-50-46.png