Forum Discussion

Re: Live character count of essay question box

Must have been a change to SL under the hood. The previous approach does not catch input changes if they are updated internally via JavaScript instead of through the browser window.

I attached an updated version that monitors for changes to the input field's value attribute.

Small changes made to each script on the two slides (SampleEmailFillIn_charCountMod.story version).

Demo: https://360.articulate.com/review/content/01a9ee61-1e49-462d-842d-1cdf59a5ced6/review

13 Replies

  • ArrolLofton-7c3's avatar
    ArrolLofton-7c3
    Community Member

    Thanks so very much for the quick response!!  I will check it out now.

  • ArrolLofton-7c3's avatar
    ArrolLofton-7c3
    Community Member

    Working like a charm, thank you once again.  Have a great rest of the day.

  • ArrolLofton-7c3's avatar
    ArrolLofton-7c3
    Community Member

    Hello again, found an issue that prevents this from working.  If there is another javascript attached to another trigger on the same slide, it stops working, any ideas? Thanks

    • Nathan_Hilliard's avatar
      Nathan_Hilliard
      Community Member

      I suppose it depends upon what the script is doing. All this script does is setup a mutation observer (event handler) that watches for changes to the value of the input box. When the string changes length, the counter text is updated. The script on the second slide disconnects the observer, since it is no longer needed. Can you post the .story file you have an issue with? If not, at least a link to the published Review 360 demo and the script text would be helpful. 

      • ArrolLofton-7c3's avatar
        ArrolLofton-7c3
        Community Member

        Hello again, I have attached a sample storyline file.  You will see a slide trigger at the top with Javascript on it, that is ok now. Initially, I had put your script at the slide trigger level too, like in your sample, and that is when it would stop working. With your script on the text entry field, all works ok, until we add another Javascript to the Save button object, and now your script doesn't work.  We still need to limit the text entry to 1200 characters and also trigger the warning if they reach the max characters too, not sure if we need to use Javascript for those operations as well.  Thanks again for your help on this, it is very much appreciated.