Html names of Action groups
June 12, 2018 12:00 AM
Lately working more and more in Lectora Online. Figured out quite a few changes in how LO uses Javascript.
One thing i would love to figure out is how to detect the html-name of an actiongroup on runtime. I dont want it hardcoded in my code... i want to use something like %HTMLNAME% to detect what the HtmlName of my actiongroup is. Offcourse i cannot add an action to it..because it will be called by some HtmlName.
In LO now this will call a specified actiongroup...
og155247.issueActions(1001); // Runs some ActionGroup
In LO i can see the htmlName...being og155247..
But how to replace that, so its generic..and when copied will use the new Htmlname ???
Discussion (5)
Because group objects do not have #HTMLNAME# it isn't easy to get their HTML object. I promise we will do something soon to make this easier for this and for executing action groups in general.
I have attached a script that I use sometimes to abstract objects from their HTML name to a known name which is more portable. This is my personal script which I'll try to find a better way to implement in the product. I would like the html name to be based off of the object name, or customizable. If you have any ideas about this I'm listening.
Hope the attached script helps you. (remove the .zip extension and import as a Lectora Online PKG file)
Tested it and it works perfect. Now i can make my more complex pages in Lectora Online completely reusable. Tried copying one i am working on now with a lot of variables, actiongroups and Javascript...and works as desired. Any other ( less Javascript minded ) developer now can just copy and paste my pages and they work without having to dive deep into the Javascript.
Thx Joe.
Kind regards,
Math
Math, that's great! It might need a little tweaking for SPP , you know the getDisplayDocument() and getDisplayWindow() methods substituted for document and window respectively. Let me know if you run into any issues. Appreciate all the help you give on the forums
- Joe
Yeah i know. Found quite a lot of differences in working with Javascript in LO compared to Inspire or Publisher, but must admit that although i was sceptical about LO untill recently, now working a lot with it, i especially do like the option you can share work easily. And now with your little trick, i can make almost anything good reusable for my teammates.
A few things i would love if that could be improved/changed, will be listing them soon...
undefined
Discussions have been disabled for this post