Hi all,
I have to apologize in advance, I'm not getting anything in my preview post window for this post...so in case it comes out looking strange!
I'm stumped on this one.. and I think it's probably something simple..but I can't see it. I've created a survey with a running timer over the entire survey and 5 groups and group index turned on.
-Group 1 contains a numeric question defaulted to = 0 called "
timedout" and another regular question with relevance set to with relevance set to
timedout == 0.
-Groups 2 to 4 contain 1 question each with relevance set to
timedout == 0 .
-Group 5 has some questions that hold recap data and are hidden. One more equation type question confirms if the user wants to leave the survey before answering all the questions ie
if(TotalAnswered == 4, "Completed message","incomplete message") and is not hidden, but a relevance of
(timedout==0)
In the template.js, I have something like this:
Code:
function() { // what to do after timer expires
$('#answer144155X1463X6926').val(1); // Set "timedout" relevance question
$('#answer144155X1463X6947').val(sessvars.ctime.current); //default is set to 0
alert ($('#answer144155X1463X6926').val());
$('#movenextbtn').click();
$('#movesubmitbtn').click();
});
If I'm on group 1 to 3 and the timer expires, I can see the alert value of "1" pop up as the value behind my relevance question "timedout". It behaves as you expect, moves me to the end of the survey and submits. All invisible! Perfect. However, if I'm on group 4, I get Undefined in the alert and moved to group 5 with the equation question displayed. I still have to click submit.
I can't figure out how or why for the life of me. I suspect it's the sequence in events firing...but can't be sure? For some reason, group 5 can't see the value behind the equation I've set?
Code:
$('#answer144155X1463X6926').val(1);
Any ideas are greatly appreciated!
Gary