connect html extension to lectora actions
February 22, 2017 12:00 AM
I was wondering if there's a way to connect Lectora's actions to fire when a something happens in a HTML extension div. Right now I'm playing with using it with html video setup, and having the button show up at the end of the video to advance to the next page.
I've seen people talk about using js to be able to do more with lectora, but I haven't really found much on how to have the two interact together when they're separate by the HTML extension. Is there any place that talks about how to do this?
undefined
Discussion (22)
Yes, there certainly is!
Every object in Lectora, including actions, gets an HTML name. That is how you can reference that object/action from JavaScript. To see the HTML name of the action, select the pull down menu on the "Action" pane of the Actions property ribbon. Clicking on the little "doohickey" in the right corner of the pane brings up that information dialog.
Once you have the name of the action, calling it from Javascript is as simple as using that name as a function call. For instance, if the name of the action is "action158", I can call it from JavaScript by calling action158();
There are a some good posts out there:
http://community.trivantis.com/shared-content/html-extension-examples/
http://community.trivantis.com/lectora-user-conference/jquery/
Most important is probably to get a fair understanding of JavaScript itself, and then learn how to use it to interact with Lectora elements.
LUC17 is not in our budget this year...next year we have it programmed (we go every other year). I'd be interested in attending in 2018 if you plan to have the course again?
Are there any other resources to hit up before then?
Deron
At the Lectora User Conference I will be teaching a full day, in person class called "Extending Lectora with Scripting". It covers using JavaScript, server side scripting, and even Database access from Lectora.
Definitely a good way to learn to script with the tool.
I have wanted to learn more about JS and HTML extensions but I always seem to miss something and have not been able to make things work. Plus, I am on a restricted network so "reaching outside" my network won't work (behind a restricted firewall).
KC mentioned "Is there any place that talks about how to do this?" and I too would like to know if there is such a place? I can get Lectora to do many, many things but run HTML Extensions and JS is not one of them!
A few years ago I attended the Lectora Extreme Users pre/post conference class and while it did show me a few cool tricks and tips, I missed how to make the JS/HTML stuff work...the action, where to put it, what to select in the dialog drop-downs, how to call it, how to make it run, etc., etc., etc.
So, I'll ask again...is there a place that talks about this? I see it here from several users saying "that's easy, do ____________!" Well...can you start at point A before you tell me about point C?
Thanks,
Deron
Awesome...I'll spend a little time in those examples and see what I have as questions...of course my first one is this entry that seems to get me each time:
Attendees should have a basic understanding of CSS, HTML, JavaScript, and jQuery.
I think I have a "basic knowledge" but then I get to the actual "how to" piece and quickly realize my basic knowledge definition is not the same as what was required!
Hoping I can figure it all out as I want to move forward in my Lectora development and I think this is the next step to really open the program up!
Deron
Thanks for the info and links to check out.
Going to the conferences isn't in my stack of cards either for this year.
Hopefully these links will me figure out what I'm missing to get things to work properly.
If enough interest i will write a series of Lectora / Javascript tutorials to get started with. In fact im working on a series of game components that use a lot of js, so guess that would be a good choice.
Math
Hi Math,
I would definitely be interested in the tutorials should you choose to make them!
Getting to LUC17 isn't really an option for Australians..
Math...I too would love to see tutorials on this...it's my main area of focus this year to learn more about.
Deron
@NickWilliams and @DeronWarman.. yes i am working on them at the moment. Will keep you both informed when they are available.
Regards,
Math
I too would be very appreciative or your js tutorials!
undefined
Just FYI, Math is doing much less in this forum (and Lectora) lately.
undefined
You might reach out to him via his Truelancers page: https://www.truelancer.com/freelancer/mathnotermans
Math...
Are these tutorials still available?
I am trying to run Lectora offline and running script to store/retrieve data from MySQL (like score, last lesson location, etc.) and think that a tutorial would be great. There is an app that launches titles local to the tablet and has a GUI for logins and training reporting.
Please let me know if the tutorial are somewhere, I tried to search and could not find them.
Thanks,
Luis
Math is being very kind, he is way more experienced than I. That said, I would try Moodle first. Its free and you wont need to dive into scripting. With php or a combo of php and js you could communicate directly between a lectora lesson and a sql database as Mr. Blackmon (There's your expert) mentioned in this thread.
I'm pretty sure the actual MySQL (not the lite version or other versions) requires installation on a server. There may be work-arounds but that is not my area of expertise.
There are other methods as well. You could even be able to write to and read from a simple text file using php and node.js. There are a ton of tutorials online for this.
Unless you are comfortable with servers, js and php, I definitely would go the Moodle route. Perhaps if Tim or John are listening they will chime in.
With everything going on now, elearning has exploded so time to create a tutorial like this is scarce (I'd have to go over a lot of this myself first as well.)
undefined
Darrel, you and Math are the gurus of Lectora in the community of posting I see you guys all over and both of you are great providers of information and I thank you both.
I am researching for more information about using the db offline. If not MySQL maybe Microsoft SQL could be an option, regardless, apparently the js can connect using a Node.js
Thank you guys.
Luis
I dont do much offline work, in fact atm work only in the cloud with Lectora Online. Reading and writing to cloud databases is easy enough. I do think for offline use Darrel knows more. With Wamp or the alike you offcourse create something similar..
Hi Darrel,
Thanks for your input. I was under the impression that a js in Lectora could do queries to MySQL and read and write the data, is that possible?
Luis
Math, If I am not mistaken, LBY is looking for an offline (no lms) approach. I would suggest a local install of Moodle as an easy approach. Either way something like Wamp Server or Xampp would be required, no? This can get quite complicated quickly for a non-programmer.
Hi Math,
Thanks for the response.
I found it in an old post (2017). I was looking for ways to use js script in Lectora to access/retrieve info from MySQL. I am doing an offline title that does not use LMS and need to keep the title data for about 6 users (score, location in lesson, date, and maybe a few more) and came across that link in Lectora and I wanted to respond since "you're The Man!"
Thanks,
Luis
:-) Where you found that truelancers link...
In fact i just created a coooool multi-user approach... uses Javascript heavily offcourse. This specific one i made working in Articulate Storyline ( its more and more used overhere in Europe...so i have to shift attention ;-) but in fact the same JS code i used i can have working in Lectora... in fact even better in Lectora because its more open...
login to:
https://fontys.talentlms.com/
undefined
Username 1: JaapAap
Password: Welkom123!
Username 2: UserDemo
Password: Welkom123!
undefined
You can login simultenauously with 2 browser-instances… changing ( dragging/dropping ) tiles (octagons) in one instance…you will see direct update in the other.
Got that working both in Storyline and Lectora on any LMS.
So anything is possible with Javascript...
@Math, I found the Truelancer link by DuckDuckGo search for your name.
Discussions have been disabled for this post