Hello all,
I am running some custom verification on a numeric grid question (Q11) vs. a numeric grid question on a prior page, Q10.
Q10 asks the respondent the number of visits they made to certain brands in the past 3 months. Q11 then asks them to assign those visits across 4 day parts (four rows in a grid) for each brand.
I'm attempting custom jscript verification to ensure that the sum of their 4 daypart answers is equal to the total # visits entered on Q10 on the prior page.
Each brand (row in Q10 and column in Q11) has its own verification. My script looks like this:
if ((SSI_GetValue("Q11_r1_c1") + SSI_GetValue("Q11_r2_c1") + SSI_GetValue("Q11_r3_c1") + SSI_GetValue("Q11_r4_c1")) != [%Q10_r1_c1%])
{
strErrorMessage = "Your total number of visits to BJ's Brewhouse should add up to the number of visits in the past three months that you indicated in the prior question: [%Q10_r1_c1%]. Please revise your answers.";
}
if ((SSI_GetValue("Q11_r1_c2") + SSI_GetValue("Q11_r2_c2") + SSI_GetValue("Q11_r3_c2") + SSI_GetValue("Q11_r4_c2")) != [%Q10_r2_c1%])
{
strErrorMessage = "Your total number of visits to Bonefish Grill should add up to the number of visits in the past three months that you indicated in the prior question: [%Q10_r2_c1%]. Please revise your answers.";
}
etc....
The problem is, the script is failing when run. I think the problem has to do with the fact that not all respondents see all brands (the brands they see are based on a Constructed list), so when the javascript runs for a brand they didn't actually see in Q10 or Q11, it doesn't know what to do. Here's what it looks like in the debugger, where the [%Q10%] reference is just blank:
if ((SSI_GetValue("Q11_r1_c2") + SSI_GetValue("Q11_r2_c2") + SSI_GetValue("Q11_r3_c2") + SSI_GetValue("Q11_r4_c2")) !=
{
strErrorMessage = "Your total number of visits to Bonefish Grill should add up to the number of visits in the past three months that you indicated in the prior question: . Please revise your answers.";
}
[\code]
Is there a way to use the "Shown" function here? Any advice?