Saving Lightbox text-field data programmatically

Jan 28, 2022

Hey developers and js coders.  We have a course where we have leveraged the lightbox functionality in a fairly deep way.  Learners use it to "take notes" and capture data along the way—there are 10+ fields on the lightbox and the lightbox can be accessed throughout the course.  Because these are very thoughtful notes, people are spending a lot of time thinking about what they write.  We’ve learned that entering data into these fields is NOT saved after each field entry as it is with text fields on regular slides--it's only saved when the lightbox is closed.

Here's the implication:  With clients who have inactivity timeouts on their logins for security (often 15 minutes), when they keep the lightbox open for more than 15 minutes--even though they are typing—it not only causes them to get logged out, but also causes them to lose everything they entered in all the fields because the data isn’t saved until they closed the lightbox.

 Here’s the question:

1) Has anyone programmatically called the function that “saves the data” in advance of Storyline doing it automatically?  I believe the actual command that gets logged is “LMSSetValue('cmi.suspend_data', stringvalue)”.

2) Or have you had success with other ways of “saving” lightbox data programmatically?

Thanks!

5 Replies
Josh Dean

Have you observed the same behavior if you assign the textbox field to a variable? The reason I ask is what if you could use a javascript "onkeyup" function that would run each time a user presses a key but only actually assign the variable after a delay. So if they were actively typing it would call the keypress function but only assign it to the variable when there is more than so many milliseconds between key presses. https://stackoverflow.com/questions/1909441/how-to-delay-the-keyup-handler-until-the-user-stops-typing?rq=1

Hope that helps.

Josh Dean

Yes, that would be my guess. Depending on how storyline exports various scorm packages and depending on where those scorm packages end up being hosted it might tap into and use browser state changes. The browser can tell when a user clicks away from a tab into a new tab or when they change to another application. I made this quick demo to show how a site can detect when a user becomes passive to active in the page lifecycle. https://codepen.io/josdea/full/WNXNzqO

It seems that scorm packages and LMS systems can save states when a user leaves. For whatever reason lightboxes and i've also wanted the current video playback position to be saved if a user closes the window may not be implemented in storyline for some reason. 

Variables may be a way to ensure your values get saved in whatever logic is used to save states.

Scott Wiley

You might add a JavaScript trigger that can use the setInterval() function to Get and Set a variable value every so often. I guess you could add a manual call to “LMSSetValue('cmi.suspend_data', stringvalue)” which should work. Usually I'd set something like this up on the Slide Master. 

Hope this help generate some ideas anyway.