Forum Discussion

GeorgeLake's avatar
GeorgeLake
Community Member
12 years ago

Character count - Java Script

Hello everyone, I'm writing a course/slide that requires the user to write a short response.  For SCORM 1.2 and Moodle LMS reasons we're capped at 256 characters.  SL's meets our needs by capping their responses.  However,  I thought it would be a nice touch to add a character/keystroke counter to let the users know when they were getting closer to their limit.

sort of like this:

I know that variables exist (my experiment is attached), it works but its messy and error prone.

I think it's possible to make a cleaner more professional version using Java Scripting, I'm just not versed egnough to make it work.  Here's an example of the code that should work??

http://www.astral-consultancy.co.uk/cgi-bin/hunbug/doco.cgi?11290

Can this be done in Storyline?

Am I barking up the wrong tree with JS?

  • I built this for someone else but should help you out

    This will only count after they have submitted until that point the variable does not exist so cannot be sent to javascript, so probably wont work for you.

    I do not know of any issues with Moodle and character length, and for scorm the variable data is compressed.  You could try using the short answer question which I think is limited to 256 characters

  • Sorry misread you are already using the short answer, you could use the code to count the character length and perhaps add in a check length button

  • Hi George! It looks like Phil is taking care of you here, but I wanted to pop in and welcome you to E-Learning Heroes!