Jump to content
Toggle menu
  • 915 articles
  • 3.8K files
  • 30.2K users
  • 279.2K edits
Catglobe Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

How to set value for a hidden question by javascript

From Catglobe Wiki
Revision as of 03:06, 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)


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

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:


- Second, create a page question type multiple questions per page:


- And then add "Age", "D_AgeGroup" to that multi page:


- After that, at "Age" question, go to CSS tab to hide "D_AgeGroup"


- Finally, also at "Age" question go to Javascript tab, write script for setting value of "D_AgeGroup" from "Age"


You are done.

Viewer only show question of Age. When inputing value on Age question, the approriate value will also set to D_AgeGroup: