July 1, 2021
Captivate TEB Actions Shortcut being ignored by Firefox when semicolon or colon
Comments
(17)
July 1, 2021
Captivate TEB Actions Shortcut being ignored by Firefox when semicolon or colon
Newbie 1 posts
Followers: 0 people
(17)

Been using Captivate since Cap 3, mostly for software simulations. Tried something new which is to have user type in last portion of C++ code line, using a TEB looking for  the closing “);” character combination that is std for this type of coding.

I have a TEB validating the entry as case senstive );”, and the action set to the shortcut character “;”.  On Edge, Chrome and IE the software demo generated by Captivate works just fine. When they type in “);” the “;” triggers the action to go to the next slide. I use this same method for trapping other keyboard entries in earlier portions of the line of code they are completing.

But in Firefox, the “;” appears to be ignored!

I could make a work-around and ask the student to use an ending <Enter> keystroke but this is less realistic and not needed on all the other browsers. A google search here and search on Adobe’s site did not yield any answers. Please help! 🙂

– Jeff

17 Comments
2022-04-11 14:52:47
2022-04-11 14:52:47

I used a slide On Enter action: Execeute JavaScript with this code.

$(document).ready(function() {
document.getElementById(“myTEB47_inputField”).addEventListener(“keydown”, function() {
if (myClosing47==”)”) {
if ((event.keyCode == 59) || (event.keyCode == 186)) {
cp.goToNextSlide();
}
}
});
});

Note that the Text Entry Box (TEB47) above is replaced with whatever you call your TEB. I match my names up with the slide numbers, so this TEB was on slide 47. I do the same for the myClosing47 variable.

Like
()
2021-09-22 17:36:30
2021-09-22 17:36:30

Creative thinking – what the solution you went with?

Like
()
2021-09-08 20:26:41
2021-09-08 20:26:41

Sure.

Like
()
2021-07-06 19:52:26
2021-07-06 19:52:26

Greg – I modified the code as such and it works, but it traps for any “;” entered on all slides.

$(document).keydown(function (event) {
if ((event.keyCode == 59) || (event.keyCode == 186)) {
cp.goToNextSlide();
}
});

So I placed the code in the TEB success action, with success being just the ending paren “)”, but that still means after that slide, the javascript is active and listening for any “;” entry.

So I thought – OK, I’ll check based on a unique slide-based TEB variable, with something like TEB variables: myClosing1, myClosing2, etc. My first slide I called it: myClosing1, but this doesn’t seem to work either:

if ((window.myClosing1 == 59) || (window.myClosing1 == 186)) {
cp.goToNextSlide();
}

I watched you beginners javascript tutorial, but that didn’t seemed to answer this issue,

Like
(7)
(11)
>
Jeff-PA
's comment
2021-07-06 20:26:35
2021-07-06 20:26:35
>
Jeff-PA
's comment

Yeah – I do not cover this topic in the guide.

If you wish to limit the listener to just that one field, try it this way…

$(document).ready(function() {
document.getElementById(“teb1_inputField”).addEventListener(“keydown”, function() {
if ((event.keyCode == 59) || (event.keyCode == 186)) {
cp.goToNextSlide();
}
});
});

Just change out  teb1  with the name of your TEB

Like
(5)
>
Greg Stager
's comment
2021-07-07 12:06:44
2021-07-07 12:06:44
>
Greg Stager
's comment

Greg, that didn’t seem to work. Here’s how I changed the code:

$(document).ready(function() {
document.getElementById(“myTEB1”).addEventListener(“keydown”, function() {
if ((event.keyCode == 59) || (event.keyCode == 186)) {
cp.goToNextSlide();
}
});
});

I’ve attached my cptx (2019) in case you’d like to take a look. Slide 1 has this code in the success action of the myTEB1 which is only looking for the “)” now, not “);” which is what I am really looking to see the student enter. Slide 3 is the same basic thing except it uses your earlier code that doesn’t check for the TEB field. Of course, after executing the script on slide 3, every “;” keystroke is detected, which is what I’m trying to avoid in slide 1 and your most recent code suggestion. I’m sure it is something I’m doing wrong. – Jeff

Like
(5)
>
Jeff-PA
's comment
2021-07-07 12:10:21
2021-07-07 12:10:21
>
Jeff-PA
's comment

You will need to keep the  _inputField  part after the name of your TEB

(“myTEB1_inputField”)

Also, if you do any copy/paste from this site – you should delete and retype all quote marks.

Like
(5)
>
Jeff-PA
's comment
2021-07-07 12:13:24
2021-07-07 12:13:24
>
Jeff-PA
's comment

The code I provided would need to go as an onEnter action to the slide.

Like
(5)
>
Greg Stager
's comment
2021-07-07 12:46:24
2021-07-07 12:46:24
>
Greg Stager
's comment

I had the _inputField originally but when it didn’t work, so I tried without. And I had it in the onEnter action as well and it didn’t work there either. 🙁

Like
(4)
>
Jeff-PA
's comment
2021-07-07 12:51:49
2021-07-07 12:51:49
>
Jeff-PA
's comment

I went ahead and took a look at the file you provided.

I removed the validation you put on the TEB along with the code in the onSuccess.
We are having JavaScript do the validation.

Then the code seemed to work fine in your project.

What I discovered – though – is that we would need to do a little more work for error prevention.

Because the code listens for the semi-colon, it also will fire if the user fails to enter that first parenthesis before the semi-colon.

I amended the code to only check for the semi-colon if a parenthesis is there.

$(document).ready(function() {
document.getElementById(“myTEB1_inputField”).addEventListener(“keydown”, function() {
if (myClosing1==”)”) {
if ((event.keyCode == 59) || (event.keyCode == 186)) {
cp.goToNextSlide();
}
}
});
});

Like
(4)
>
Greg Stager
's comment
2021-07-07 12:58:02
2021-07-07 12:58:02
>
Greg Stager
's comment

Thanks – it appears that the issue was the quotes. I copied the code into notepad++ directly and then from there into the Captivate script window, but did not retype the quotes.

I’ll give this last idea a whirl. Outside of the topic – but I was a guitar player for many years in our church worship team. Seems we have a common interest perhaps.

Like
(5)
>
Jeff-PA
's comment
2021-07-07 13:10:00
2021-07-07 13:10:00
>
Jeff-PA
's comment

Don’t forget to uncheck the box for “Validate User Input” and just have the onSuccess set to No Action.

Awesome, Jeff – I primarily play on worship team. Experimenting with some new gear – just picked up a looper pedal and am excited to see what can be accomplished.

Like
(4)
>
Greg Stager
's comment
2021-07-07 13:28:56
2021-07-07 13:28:56
>
Greg Stager
's comment

Works! Now to implement in actual project.

Son and I bought a Pigtronix looper a few years ago. My son taught himself some of Phil Keaggy’s songs (perhaps you’ve heard of him – if not, check out his music) and when he’d play and I was in a different part of the house, I wasn’t sure if he had the Keaggy mp3 playing or was playing himself! I never got time to use it so he bought my half and just moved out this past weekend to live on his own.

Like
(5)
>
Jeff-PA
's comment
2021-07-07 13:53:04
2021-07-07 13:53:04
>
Jeff-PA
's comment

Awesome! Glad we got it figured out!

I have heard the name and I am sure I have heard a song or two but couldn’t name any. I would need to hear it to recognize it.

Like
(5)
>
Jeff-PA
's comment
2021-08-11 14:52:37
2021-08-11 14:52:37
>
Jeff-PA
's comment

Great info

Like
(1)
2021-07-02 12:14:22
2021-07-02 12:14:22

What if you used an Execute JavaScript action in the onEnter of your slide to listen for the semi-colon and perform a function?

Firefox doesn’t handle the keypress stuff the same so you have two values there. You have 59 for Firefox and 186 for the others.

Just change out the console.log with your own actions.

 

Attachment

Like
(7)
(1)
>
Greg Stager
's comment
2021-07-06 10:17:27
2021-07-06 10:17:27
>
Greg Stager
's comment

Thanks Greg – I’ll have a look at your script. Need to refresh by  JavaScript abilities in captivate.

Curious why a browser like FF would send out a different code for a std keyboard character? UGH! I was looking for a tool to display the ASCII codes when pressings keys in the various browsers, to determine this myself. How did you uncover this code difference? Thanks again!

Like
(4)
Add Comment