Make text box active automatically

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?

ActivePresenter Version:
7.1.0

OS:
Win 10

Notes:

Hi Roger,

You can do that by adding the following JavaScript action to On Correct event of each text box:

 // replace next_textbox_name by the name of the next text box
prez.object('next_textbox_name').textNode.focus();

Regards

Awesome, I’m totally new to this and not a JavaScript guy, but this makes total sense to me. Many thanks.

Roger

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.

Roger

Solved it !

I solved it by using a double quote:

prez.object(“txtTwelve”).textNode.focus();

This appears to the be the final solution.

Roger

Hi,

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:

singlequote

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).

Regards

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.

Roger