JavaScript Run Action Group
March 25, 2022 12:00 AM
Hello - just wondering what I am doing wrong when manually calling my action group from JavaScript.
I have created a group of 6 actions that I'd like to run at the end of my JavaScript code.
However, when I call runGroup_og38635() at the end of my JavaScript, I get the error below. I know was able to find the runGroup_og38635 from sifting through the html page.
I know my group of 6 actions works OK because when I set it to launch with an OnTimedRunActGrp w\ 0.5s it has no problem doing what they need to do.
My HTML Extension with my swath of JavaScript is a Bottom of file scripting extension.
I could keep running it with the OnTimedRunActGrp at 0.5 but I feel like that is sloppy when it only needs to be invoked at the end of my JavaScript.
Discussion (6)
I think I want to go down the path of this but unsure where to find the content they are referencing...
https://rockstars.elearningbrothers.com/discussion/436521/action-grpups-from-javascript-in-lectora-online
@wheels would you know or have the information handy?
Do action groups have the "visible" property?
Unsure if this question is directed at me, but all these sub-actions run with a conditional statement built in for a check on a variable.
I don't know JavaScript, but that's not a variable. It's a property. If the Class ActionGroup does not have the IsVisible property, you'd get that exact error.
Do action groups have the "visible" property?
Unsure if this question is directed at me, but all these sub-actions run with a conditional statement built in for a check on a variable.
I've been complaining since at least 2016 that the JavaScript interface with Lectora is not documented in a useful way for a beginner/occasional user like me.
Ahh. Yea, sorry @carlfink if I came off snippy - I wasn't trying to be.
After spending many more hours of playing with the advanced functionality of Lectora (under the hood so to speak) by publishing and sifting through the published files, I soon realized that I had to have an Action assigned to an object for it to have any control functions - actionShow() and actionHide() - assigned to it. If you simply put an object on screen and do not do anything with it, then no JavaScript functions get assigned to it at publishing.
To circumvent this, I simply added a OnPageShow to each of my objects that I was going to be handling with advanced JavaScript to set the state of the object when the user were to come to the page. For example, if an object was to be hidden at first launch, I put a OnPageShow Hide This Object which then allowed me to control visibility after the fact. Now, I didn't do any testing or functionality work to asses if the error code I got in the original message was resolved after I learned that, but I assume it would.
One day, I am going to write up a cheat sheet with all the JavaScript calls and things I've learned that aren't actively published by the vendor. I am in no way saying that Lectora is a poor product by that statement because it truly does give you the flexibility to do what you want with a touch of WYSIWYG.