Problem:
I have multiple text boxes on a slide, and “submit” set to auto. After a user successfully completes a text entry, I need the next box to become active (insertion point cursor moves into the second box) automatically, so that the learner does not have to click or tab from box to box. Is this possible?
Although this statement looks good to me from my limited knowledge of JavaScript, it results in a parsing error. Here is the exact statement as I put it in the JavaScript editor - and the name of my target text box is txtTwelve. The code is under the On Correct condition of the previous text box. Any ideas where I’ve gone wrong?
BTW, I’m using Chrome Version 67.0.3396.99 (Official Build) (64-bit)
prez.object(‘txtTwelve’).textNode.focus();
The result is:
localhost:31686 says
Error parsing the presentation. Check the browser console for more information.
Additionally, I discovered I can avoid the error message by removing the single quotes from txtTwelve, but the focus still does not move to the desired text box.
I’m sorry for the late reply due to different time zones.
The parsing error occurs because the single quote character in my code is changed to different characters (left and right single quote) in your code. Please take a look at the following screenshot to see the difference:
To prevent character changing like this, please copy my code as is (don’t copy from your quote), then paste it into JavaScript editor inside ActivePresenter.
You can use double quotes instead of single quotes. But please type it directly in JavaScript editor or in a plain text editor (e.g. Notepad), otherwise it may change to a different quote character (as the case of the single quote).
Ah, that makes sense. I’m not sure where the “smart quotes” came from but I can see now why it could mess it up. Your help to this newbie to both AP and JavaScript is so appreciated.