Highlighted

TEB and Function Key JS code

New Here ,
Jul 08, 2020

Copy link to clipboard

Copied

Hello Rod,

In one of my simulation, I have losts to TEBs. After entering the text you need to press the Function Key (in this case F3). To do the shortcut, I am using the below script. This works amazing when its with just the click boxes.

Anyways, the issue that I am facing is, once I cross the slide that executes this JS, the TEB stops working. It does not allow me to enter any text further.

 

$(function(){
//Yes! use keydown 'cus some keys is fired only in this trigger,
//such arrows keys $("body").keydown(function(e){
//well you need keep on mind that your browser use some keys
//to call some function, so we'll prevent this e.preventDefault();

//now we caught the key code, yabadabadoo!!
var keyCode = e.keyCode || e.which;

//your keyCode contains the key code, F1 to F12
//is among 112 and 123. Just it. console.log(keyCode);
});
});

 

Please let me know if you know any fix for this issue.

 

Views

52

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

TEB and Function Key JS code

New Here ,
Jul 08, 2020

Copy link to clipboard

Copied

Hello Rod,

In one of my simulation, I have losts to TEBs. After entering the text you need to press the Function Key (in this case F3). To do the shortcut, I am using the below script. This works amazing when its with just the click boxes.

Anyways, the issue that I am facing is, once I cross the slide that executes this JS, the TEB stops working. It does not allow me to enter any text further.

 

$(function(){
//Yes! use keydown 'cus some keys is fired only in this trigger,
//such arrows keys $("body").keydown(function(e){
//well you need keep on mind that your browser use some keys
//to call some function, so we'll prevent this e.preventDefault();

//now we caught the key code, yabadabadoo!!
var keyCode = e.keyCode || e.which;

//your keyCode contains the key code, F1 to F12
//is among 112 and 123. Just it. console.log(keyCode);
});
});

 

Please let me know if you know any fix for this issue.

 

Views

53

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Advocate ,
Jul 08, 2020

Copy link to clipboard

Copied

Seems like maybe your TEB is losing focus.

I know I had issues once with a TEB constantly losing focus so I had to force it.

 

Also - is that all of your code - or is there more?

From what you've shown, it looks like there is an extra set of   });  at the end.

Or perhaps simply the commenting out of lines is leaving the active code in such a way that things break.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jul 08, 2020

Copy link to clipboard

Copied

Yeah thats all is the code.

Even  I click on the TEB to get its focus back, it still doesnt type. I can attach the cptx file here to test.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Advocate ,
Jul 08, 2020

Copy link to clipboard

Copied

What if you try something like this...

The question is - what do you want to have happen when the user presses F3?

In the script shown below - we add the listener which calls the function each time a key is pressed.

The Key Code for  F3  is 114 so we can then include an if statement within the function that is called each time a key is pressed such that if our variable equals 114 to go ahead and do something.

This code assumes a TEB with the ID of  entryBox and a Captivate variable called key.

This is placed in the on Enter action for the slide.

 

Stagprime_0-1594232259471.png

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Advocate ,
Jul 08, 2020

Copy link to clipboard

Copied

Rod -

I hope you don't mind me trying to help since you were requested specifically...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
RodWard LATEST
Adobe Community Professional ,
Jul 08, 2020

Copy link to clipboard

Copied

Go for it!  I have more than enough problems to solve.  All the merrier.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
Captivate User Guide
New Group