Forum Discussion
Live character count of essay question box
I looked at your file and I've attached a modified version here. The script to count the characters does work and it doesn't matter where it's placed, as long as it's after the LMS loading script. I moved it back to the timeline start position for convenience.
The reason your scripts were stopping the function is because they contained some errors. When JS stops due to an error, it can stop some of the other scripts on the page as well. The notable errors were:
- The first comment line of the button script was not actually commented (missing '/').
- The variables in the scripts did not match the variable names of the SL variables.
The script was also storing the TextEntry1 variable in the LMS when it needed to store the UserNotes variable.
Have you actually used these scripts before? I ask because the method used to get the lmsapi assumes its location in the DOM. For example, in my LMS the api is at a different parent level than what was specified in the script. I added a function to the begining of each script that checks multiple levels until it locates the correct lmsapi level. You might want to use that in the future.
Anyway, I published the modified version to SCORM 1.2 and uploaded to my LMS to test it. It worked as expected, counted the text, and stored/retreived the typed data.
I also added one line to the counter script that updates the counter when initializing the event handler, so reloaded values from the LMS show the correct length.
Make sure to test in your LMS since the LMS functions will not work elsewhere. You might consider adding a test for if the LMS is present, and adding conditionals to the LMS function calls so you can test your code in Review more easily.
Hi again and thanks for all the additional help. I am kind of just helping out to get a solution for this, I am no Javascript expert, kind of techie but all the other experts are busy working on other projects.
- ArrolLofton-7c38 months agoCommunity Member
Hello again and good morning. Really appreciate all the help and wanted to know if you are available for paid contract work? Thanks
- Nathan_Hilliard8 months agoCommunity Member
email me: nhilliar (at) purdue.edu
Related Content
- 10 months ago