Adding custom validation for sum of numerical text entry questions | XM Community
Solved

Adding custom validation for sum of numerical text entry questions

  • 16 May 2018
  • 1 reply
  • 95 views

Hi!

I am working on setting the custom validation for the below questions:

!

The purpose is to add logical validation like:
1. Domestic Executive Employee number should be lower or equal to Total Corporation Executive Employee number
2. Domestic Management Employee number should be lower or equal to Total Corporation Management Employee number
3. Domestic Other Professional Employee number should be lower or equal to Total Corporation Other Professional Employee number
4. Domestic Other Clerical Employee number should be lower or equal to Total Corporation Other Clerical Employee number
5. Sum of Domestic Employees given by level should be less or equal to Total Number for Domestic Employees given in the first question
6. Sum of Total Corporate Employees given by level should be less or equal to Total Number for Total Corporate Employees given in the first question

Right now I am doing it using Custom validations, pipe texts and equations like this: $e{ QR~QID2~1~1~TEXT + QR~QID2~2~1~TEXT + QR~QID2~3~1~TEXT + QR~QID2~4~1~TEXT }


!

I was wondering if there is a faster way to input such validations, eg. by using some Java Scrips?

Thank you in advance for your help!
icon

Best answer by Samarth 30 May 2018, 20:22

View original

1 reply

Userlevel 4
Badge +5
Hi @Dorota ,

You may use Javascript/jquery for this create extra question below these questions and for each condition allocate a box where initial value is "0" and once the condition is met the value will be "1". after which the custom validation can be applied on the additional question.

Regards,
Samarth

Leave a Reply