June 15, 2020
Execute JavaScript on a Text Box Entry via the ENTER key on success and failure.
Comments
(2)
June 15, 2020
Execute JavaScript on a Text Box Entry via the ENTER key on success and failure.
Newbie 1 posts
Followers: 0 people
(2)

Captivate 2019, Windows 10, HTML5 output only.

Have a Text Entry Box with the Enter key as a shortcut. Would like to execute a JavaScript function when the user presses the Enter key. It is possible to do so when the answer is correct (on success), but need to be able to execute it when the answer is incorrect as well. The JavaScript evaluates whether the answer is correct or not and then shows/hides several assets on screen accordingly. Need to be able to still edit the Text Entry Box after executing the JavaScript.

Thank you.

2 Comments
2021-11-30 06:18:25
2021-11-30 06:18:25

did you get the result you were looking for?

Like
2020-06-17 10:39:48
2020-06-17 10:39:48

As long as you do not have Infinite attempts the TEB has a Success and Failure event, at least if it is validate. Not completely sure that is the case. Any event can launch any command from the dropdown list, including Execute JavaScript. Maybe learning first about the basics of the TEB could help?

http://blog.lilybiri.com/text-entry-boxes-back-to-basics

What you cant to do would be very easy with advanced or shared actions.. but you want JS.

 

Like
(1)
Add Comment