Hi ... the answer for the question Zachary answered previously works beautifully for a straight numeric. But I have to do the same thing in a 1 column grid where the rows depend on a previous question. This is what I've done (it doesn't work):
var resp1 = $('#[% QuestionName() %]_r1_c1').val().trim();
var resp2 = $('#[% QuestionName() %]_r2_c1').val().trim();
var resp3 = $('#[% QuestionName() %]_r3_c1').val().trim();
var resp4 = $('#[% QuestionName() %]_r4_c1').val().trim();
var resp5 = $('#[% QuestionName() %]_r5_c1').val().trim();
var resp6 = $('#[% QuestionName() %]_r6_c1').val().trim();
var resp7 = $('#[% QuestionName() %]_r7_c1').val().trim();
var resp8 = $('#[% QuestionName() %]_r8_c1').val().trim();
var resp9 = $('#[% QuestionName() %]_r9_c1').val().trim();
var resp10 = $('#[% QuestionName() %]_r10_c1').val().trim();
var resp11 = $('#[% QuestionName() %]_r11_c1').val().trim();
var resp12 = $('#[% QuestionName() %]_r12_c1').val().trim();
if(SSI_GetValue("B1A_1") == 1)
{
if (resp1 && !/^[0-9]*(\.[0-9]{2})?$/.test(resp)) {
strErrorMessage = 'Please enter a price for the "Birthday of your children" row';
}
}
else if(SSI_GetValue("B1A_2") == 1)
{
if (resp2 && !/^[0-9]*(\.[0-9]{2})?$/.test(resp)) {
strErrorMessage = 'Please enter a price for the "Birthday of other children" row';
}
}
else if(SSI_GetValue("B1A_3") == 1)
{
if (resp3 && !/^[0-9]*(\.[0-9]{2})?$/.test(resp)) {
strErrorMessage = 'Please enter a price for the "Birthday of family member (not own child)/close friend" row';
}
}
... etc
A. What am I doing wrong?
B. There's gotta be a better way to code this anyway, right?
I'm on 9.10.1.