CustomNumberQuestion

The file customnumberquestion.js implements the class CustomNumberQuestion, which descends from ITPQuestion. It registers this class with the itpelementfactory and also registers a mapping between the element type question_number and the class type ITPElement.ITPPageElement.ITPQuestion.CustomNumberQuestion.

CustomNumberQuestion adds four methods; thousands, countseparators, internal2screen and screen2internal, that implement the thousands separator logic. The details of this implementation are not relevant to this example.

More importantly, CustomNumberQuestion overrides the following methods:

The combination of these overrides is sufficient to implement the custom thousands separator behavior. During initialization the custom implementation initScreenElements will manipulate the screen and bind the thousands separator logic. During form entry and submission the other overrides will combine to make sure the answer is interpreted and validated correctly.