Hi all,
I’m using javascript to select stimuli for participants. I have a single loop-and-merge question, which is run several times. Each time, a new stimuli is selected from a javascript list to be shown to participants.
The problem is that I want to force responses but if the ‘next’ button is clicked without answering the question, the page reloads, the javascript re-runs, and anew stimuli is selected. The new stimuli isn’t shown to participants but it is stored as embedded data, which will render my results unusuable.
Is there a way to ensure that the javascript will only be run when the participant successfully moves on to the next question? I tried moving the script to ‘addOnUnload(function()’ or ‘addOnPageSubmit(function)’ but neither of those solved the problem.
This user:
seems to have had the same problem but I’m afraid I don’t understand the answer there, so any additional information would be really helpful :)
P.S. As a backup, I suppose I can add a new page between each question to run the code but that will extend the length of the survey and annoy participants, so I’d prefer not to do it.
P.P.S. In another question, I avoid the problem by hiding the ‘next’ button until the question has been answered but I can’t figure out how to do this with slider questions.