Hi everyone. I have a very short 3 question survey. I am distributing by email with the first question embedded as an inline email question. It is the only question on the page (added a page break to the survey editor) between Q1 and Q2. I didn't want respondents to have to click the next button to continue so I tried using Javascript to auto advance to the next page after 1 second. It goes to the next page, however on that screen the Javascript is still trying to advance after 1 second. I don't understand why it is applying here too. The Javascript is only on Q1. A page break separates Q1, then Q2 (display logic applies) and Q3 are on the next page. There is no Javascript on either Q2 or Q3. My survey is published so that shouldn't be a problem. Any ideas are welcome!
The script I applied on Q1 is now attached.
Page 1 / 1
Can u trying adding another 2_questioa in separate block.
Hard to tell without seeing your JavaScript. Maybe you used setInterval instead of setTimeout?
Sorry I meant to attach the script and forgot. I added it to my first post. It's code from Princeton's cheat sheet. Attached again.
@bansalpeeyush29 thank you for your idea. I tried moving Q2 and Q3 to their own block (still no Javascirpt on those questions or blocks) and it is auto advancing in Chrome.
PeriodicalExecuter is the same as setInterval. Use setTimeout instead:
```
setTimeout(function () {jQuery('#NextButton').click();},1000);
```
```
setTimeout(function () {jQuery('#NextButton').click();},1000);
```
> @TomG said:
> PeriodicalExecuter is the same as setInterval. Use setTimeout instead:
> ```
> setTimeout(function () {jQuery('#NextButton').click();},1000);
> ```
Great @TomG 😀
@bstrahin,
function used by you will execute periodically.
check below link:
http://api.prototypejs.org/language/PeriodicalExecuter/
> PeriodicalExecuter is the same as setInterval. Use setTimeout instead:
> ```
> setTimeout(function () {jQuery('#NextButton').click();},1000);
> ```
Great @TomG 😀
@bstrahin,
function used by you will execute periodically.
check below link:
http://api.prototypejs.org/language/PeriodicalExecuter/
@TomG, @PradeepKotian, and @bansalpeeyush29 thank you for your quick responses! Working like a charm now. And @PradeepKotian thank you for the extra resources. I'm not a coder and try to recycle publically available code, but obviously do not have a deep understanding when things go wrong. It's great having experts like you to help us noncoders out!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.