How to validate household age composition based on number of household members? | XM Community
Skip to main content

I have a household composition question set up like this:
How many people are there living in your household?
 1 








10 
More than 10 people live in my household

Then I have a follow up question asking for the age ranges of those household members with a text box beside each age range:
Please indicate the age of the members of your household.
0-3 years
4-9 years
10-15 years
16 - 17 years
18 - 24 years
25 - 34 years
35 - 44 years
45 - 54 years
55 - 64 years
65 - 74 years
75 years or older
How do you set this up with a validation?
I set it up as as a constant sum and pasted ${q://QID80/ChoiceGroup/SelectedChoices} in the "Choice Must Total" box but it does not seem to work.

try using jquery which would help in achieving the customized validation.


Do you have the jquery code?


rarcega what you have done should work for households of 1-10 people (validation will not work for the text option of 10 or more people). One thing you can try to avoid jquery is adjust your first question to an open-ended text box (use validation to check they submit a number) instead of using the radio buttons. Then copy & paste in the piped value from Q1 into your validation for Q2 (constant sum) for Must Total.
The validation should work even if the questions are on the same page, but if it isn't experiment with putting them on multiple pages. Also consider if you need to split it into two questions or if you can just ask your second question and use your constand sum total to infer the value for Q1. This will reduce the question load on your respondent.


Leave a Reply