Forum Discussion
Saving checkboxes in Rise
Hey guys,
I saw Mike Amelang’s inventive solution to create a Learning Journal in Rise, and it inspired me to post something similar!
Recently our team built an observational checklist in Rise, only to discover that Rise doesn’t save the value of checkbox lists between sessions! ☹️ I’ve seen other people on these forums disappointed by this as well, so I thought I would share our hotfix solution. This will make it so that your Rise course will keep checkboxes ticked/unticked between sessions.
What you’ll need:
- My checkbox.js script (Right click > Save As…)
How to use it:
- Unzip your Rise SCORM .zip file and
- Navigate to the '[RISE COURSE]\scormcontent\' subfolder
- Copy 'checkboxes.js' into this folder
- Open 'index.html' in a text editor (e.g. Notepad++)
- Search for the following line of code:
<script type="text/javascript" src="lib/lzwcompress.js"></script>
And paste this line below it:<script type="text/javascript" src="checkboxes.js"></script>
- Search for the following line of code:
const data = JSON.parse(stringData);
And REPLACE it with these lines:stringData = stringData.split("checkbox");
convertSuspendedData(stringData[1]);
const data = JSON.parse(stringData[0]); - Search for the following lines of code:
function concatLMSData(data) {
And REPLACE it with these lines:
assign(cache, data);
LMSProxy.SetDataChunk(compress(cache));
}function concatLMSData(data) {
assign(cache, data);
saveCheckboxes();
checkboxData = JSON.stringify(checkboxMap);
LMSProxy.SetDataChunk(compress(cache) + "checkbox" + checkboxData);
} - Re-zip your course and upload to your LMS
NOTE: This script only tracks “Checkbox list” block types.
How it works (for those interested):
Identifying and tracking checkboxes
Blocks in Rise are loaded procedurally as the user scrolls, and each lesson is effectively a separate webpage which animates in and out as the user navigates.
This immediately throws up obstacles for identifying when and where certain blocks are used in a course because they will rarely be displayed ‘all at once’. As a result, using JavaScript to find and keep track of all the checkboxes in a course isn’t as simple as just accessing the DOM to count each checkbox element on the page. Instead, the script keeps track of each checkbox as it loads in and out of existence (as well as their respective states, and respective lesson associations).
When a user accesses a lesson in Rise, the lesson ID will be appended at the end of the page URL:
By using JavaScript, each checkbox on the page is associated with its respective lesson ID by appending it as an additional attribute:
When the user jumps to another lesson, the lesson ID in the URL changes with it. This is when the script counts the checkboxes again, but this time excludes the checkboxes with the old lesson ID. It then assigns the new lesson ID to the new checkboxes loading onto the page.
At the same time, these lessons IDs and checkboxes get saved into a variable (called checkboxMap), where the lesson ID is used as a property, and the corresponding checkboxes are saved into its value as an array.
checkboxMap variable:
Every time the user navigates, the script cross-checks this variable with the lesson ID from the URL to determine whether or not the lesson had already been visited. If the lesson ID is not found in the variable, it will be added as a parameter and will continue to track the checkbox states as normal. However, if the lesson ID is found, it will reference the values in the array next to it and mark each of the boxes and checked/unchecked.
Appending this information to the suspend data
The checkbox data needs to be converted into a simpler format so that it could be transmitted and stored by the LMS. The JSON.stringify() method does this automatically by converting object variables into text strings. After converting the checkboxMap variable into a string, it gets appended onto the end of Rise’s suspend data:
Modified suspend data output:
White = Rise’s auto-generated suspend data
Blue = Separator keyword
Yellow = Custom checkbox suspend data
These two chunks of data also get separated immediately upon resuming a course. Otherwise, Rise would attempt to parse the checkbox information (which it doesn’t understand) and corrupt the session. This is done using the split() method with the separator keyword:
After separating the checkbox data, it gets converted back into the checkboxMap variable using the JSON.parse() method. The script then continues to operate as normal – counting checkboxes in each lesson and applying the checked/unchecked states to them.
Further reading:
Forum discussions:
https://community.articulate.com/discussions/rise-360/forcing-completion-of-a-checkbox-list
Suspend data:
https://articulate.com/support/article/Rise-Exceeding-SCORM-Suspend-Data-Limits
https://elearningindustry.com/getting-started-with-scorm-tracking-course-specific-data
https://scorm.com/scorm-explained/technical-scorm/run-time/run-time-reference/
LinkedIn post:
Let me know if you have any questions or suggestions to improve the script! 😊 I know this method is not ideal for most people, so it would be great if Articulate implements this as an official feature at some point.
- kevinbakerCommunity Member
Would love to see this become a native feature in Rise.
- BenMcKenna-ba88Community Member
Hey Jennifer,
Thanks for testing this out! I completely forgot to mention that the checkbox.js file contains a line which redirects the user back to the main menu when they resume the course.
(Highlighted yellow)
The reason for this is because the checklists ONLY get applied when the page URL changes... So I redirect learners to the starting page so that they are forced to click on a link.
The learner's progress is still saved though - they just have to click the continue button on the starting page to resume where they left off. I know this is a hacky solution, so I'll absolutely look into fixing this when I have the time.
If bookmarking is absolutely crucial, you should be able to remove the highlighted code above - just keep in mind that if the current lesson contains a checklist, it will appear unchecked until they navigate to another lesson.
Sorry for the oversight! Hope this clarifies things a bit better.
- JenniferRo-2332Community Member
Thanks so much for your response Ben! I am actually finding that the
progress is not saved and when clicking on the Get Started button from the
starting page of the course it is showing 0% complete.Would love to see a solution that keeps the checkboxes selected and saves
the learner's progress in the course, so I will continue to follow this
post.Thanks again for your help!
Jennifer
- BenMcKenna-ba88Community Member
Oh in that case I'm a little stumped! It doesn't sound like an LMS issue since it seems to be saving checkbox data, but I may have missed a step...
Just double check that your index.html changes look something like this:
stringData[0] contains the progress data, and stringData[1] represents the checkbox data. So if there's an issue with progress, then it's probably due to stringData[0]...
- hkanstrmCommunity Member
three years ago,
Still not a built in function for checklists that stay on between sessions?
Must be one hard nut to crack :)
"I know this method is not ideal for most people, so it would be great if Articulate implements this as an official feature at some point."
I cant really say what " at some point means".
But, i dont think that "point" was thought of as to be be more then three years later.
Does this function really need +1 and hundreds of signatures to be implemented? - RowanTrevorCommunity Member
Thanks for this Ben. I've tried your process and it does retain the checkboxes, but every time I exit and go back in, the saved checkboxes have bumped down one place. So for example, if I checked boxes 1 and 4 in a list, when I come back in, boxes 2 and 5 are now checked. Looks like something in the way it's counting the boxes? Has anyone encountered this or have any ideas of a solution? Thanks everyone.
- MeaganGriffin-fCommunity Member
Hi Rowan, This is what I'm encountering as well. I'm hopeful someone has a solution. It's so close to perfect!
- MeaganGriffin-fCommunity Member
Hi again, Rowan - I worked with a developer at my company, and I think we found a solution for this!
In the checkboxes.js file, locate this line: checkboxesInLesson = document.querySelectorAll('[data-lesson-id="' + currentLesson + '"]');And, REPLACE it with this line: checkboxesInLesson = document.querySelectorAll('.block-list__checkbox', '[data-lesson-id="' + currentLesson + '"]')
We hope this works for you! -Meagan & Werner- RowanTrevorCommunity Member
Thank you Meagan, I appreciate you taking the time to send this through, I'll give it a try!
- JenniferRo-2332Community Member
Hi Ben, thanks so much for this! I am trying to follow these steps, but I do not see the following line of code in SCORMContent folder.
const data = JSON.parse(stringData);
Any help would be appreciated! Thank you!
- JenniferRo-2332Community Member
Actually, I was able to find the line of code. I've uploaded the SCORM zip file to my LMS with no issues, and after launching the course, the checkmarks are saved as I navigate from lesson to lesson; however, when I exit the course and relaunch it, my progress is not saved/bookmarked. Is this an issue with the LMS or am I missing something with the javascript edits? Thank you!
- JenniferRo-2332Community Member
Thanks so much for all your help Ben - It is working now!
I was missing the following line of code:
LMSProxy.SetDataChunk(compress(cache) + "checkbox" + checkboxData);
- BenMcKenna-ba88Community Member
Glad to hear it Jen :)
I looked over my instructions and realised that I completely left that step out - so that was my mistake! I've updated the original post so it should include everything now.
- EmmaPawson-d4e9Community Member
Hi Ben, I'm having trouble with the original learning journal not loading when I add it to Amazon S3 or SCORM cloud - the index.html loads fine locally. I suspect it's a Rise update that causing it because I re-published an old Rise course that worked just fine and it doesn't work anymore. Do you have any suggestions?
You can see my original post here https://community.articulate.com/discussions/rise-360/learning-journal-in-rise?page=11#reply-849966
- JeffRands-90d4cCommunity Member
Just wanted to say a big thanks for this Ben, just used it for a compliance course I have put together - and it works perfectly.
Thanks for sharing.
- RoniBorriCommunity Member
This is fantastic! I'm looking forward to trying it out.
I assume that we would need to redo the code tweaks each time the course is updated? It's a small price to pay for this functionality though!
- JohnMoore-23846Community Member
This is good stuff Ben—well done!
- AvrilBrennanCommunity Member
Hi Ben,
This script does not seem to be working for me at all. I have tried it a few times and my RISE module - which has a lot of checkboxes in it - still won't save the tick boxes when I leave and go back in.
Is there any chance of working through this issue with you or someone else?