Forum Discussion

JudyMcDonough-f's avatar
JudyMcDonough-f
Community Member
9 months ago

Live character count of essay question box

I have an essay box with a limit of 1000 characters. I'd like to show (below it) a live character count of - either - characters used or characters remaining (either one, doesn't matter to me).  I initially tried to create a variable to "add value" which would, in theory, add 1 for each character entered and then show that number. But it's not working.  I've included the file for reference.

Is there a way to do this?  Preferably without javascript.  :-)  Thanks!

 

  • Hi Judy. I don't think you will find a way to do this without some JavaScript.

    If you are still interested, I attached an updated version of your story with a working character counter.

    https://360.articulate.com/review/content/55f8f9ac-4384-45f0-8330-3022588abaa7/review

    I added a small JS snippet on the first slide's timeline start. It finds the email body input box, attaches an event handler which watches the contents of this box, and updates the displayed AAcount variable whenever the contents change.

    I disabled the add 1 to AAcount trigger

    I added two text variables in SL:

         fnListener (a reference to the event listener)

         refInputBox (a reference to the text input box for the email body)

    I added one last snippet of JS on the timeline start of the next slide (after the user successfully submits the form) that removes the event handler that was attached to the input box since we don't need it anymore. It uses both of the new variables to know what needs to be removed.

  • WOW, Nathanial!  This is exactly what I was looking for!  Thank you so much!  It's perfect!!  :-) 

  • I'm not sure what you mean. If you want to clear the email body text and reset the counter to 0 when you do, just:

    Add one trigger to set TextEntry7 to (blank) which will clear the text input, and

    Add another trigger that resets the AAcount variable to 0 when TextEntry7 is cleared.

    The original JavaScript will not be triggered unless the user types in the input field. Just clearing it will not cause an event to fire, so you have to change it manually.

  • Flike19's avatar
    Flike19
    Community Member

    I remember when I was working on a similar project and wanted to avoid JavaScript, too. I kept searching for an easier solution, but nothing really worked. In the end, I had to give in and use a simple JavaScript snippet. It wasn't as hard as I thought. If you're really stuck and need to focus on other tasks, you might consider getting professional help. I hired someone from https://edubirdie.com/essay-writers-for-hire, and they got me through a tough spot. Sometimes, outsourcing saves time and stress. Trying something basic yourself could be a good start though!