I need to do a poverty question, but it should only be shown under specific conditions based on household size and income.
I tried the code below, but that breaks the branching AND doesn't do my alert. The alert is just for testing to see if the first part works.
I'm guessing I need to put the variable definition somewhere else.
[CODE]
<script>
var householdSize = Q1_r1 + Q1_r2 + Q1_r3 + Q1_rn;
var GLOBAL_SAWTOOTH_[% QUESTIONNAME() %]_SETTINGS = {
branchings: [
{
dependentQuestion: 'povertyQuestion',
condition: function() {
return (householdSize) == 1 &&
SSI_GetValue('Income') == 3);
},
selectMinimum: 1
],
errorMessageSettings: {
missingAnswer: 'A response is required.',
minimumChecks: 'The minimum number of checks is [MINIMUM].',
minimumCharacters: 'The response must contain at least [MINIMUM] characters.'
}
};
if (householdSize >= 2) {
alert (householdSize);
}
</script>