Character Counts in Entry Fields

cbagby5306
cbagby5306 Community Member Posts: 7
We have a page in our course that is locked based on a character count. Once the student types 300 characters, the page unlocks, and they can move forward. Easy, right? We have used Wendy Miller's suggested approach for MANY years and did not encounter problems until recently.

https://www.trivantis.com/blog/lectora-advanced-adding-character-counter-entry-field/

Some of our students are bypassing this character count; we are getting multiple "null" entries in our xAPI results. For testing purposes, I added this character count variable to my screen, so that I could watch the variable change as I typed. (Yes, our students have figured out that they can type 300 letter z's and move on. This is not the issue.)

Problem: If you use Wendy's suggested method - create a separate character count variable - it doesn't matter WHERE I type on the screen. That character count variable is changing. I can click anywhere on the Lectora screen OUTSIDE the entry field, and just poke keys at random. The entry field is empty - but that count is moving - and the page unlocks. This means - I could 100% send an empty Entry field to the LRS... giving me a "null" in my reports. This doesn't happen often - but it happens.

My question!! If Lectora is able to set a maximum character count on an Entry field, WHERE is Lectora saving THAT count? I want the characters to count based only upon what the user actually types IN the field. I want this ONE variable to control them all...yes, like Highlander.

Am I making any sense to anyone? :)

 

Comments

  • brobertson4402
    brobertson4402 Community Member Posts: 24
    Try this. Although it doesn't accommodate all the possible keystroke possibilities including arrow keys, backspace, delete, etc ... it will count only changes to the entry field.  I'm using a character count of 10 rather than 300 in this example.

    Create a variable to hold your character count, i.e.  c1 with an initial value of 10.

    Add the following actions to your Entry Field:

    Trigger:  Select/Change
    Action:  Modify Variable
    Target:  C1
    Type:  Subtract from Variable
    Value: 1
    If:  C1 Not Equal To 1 (C1 equals 1 when the learner type the 10th keystroke)
    Else: enable the 'Next' button or whatever you want to happen when hitting the keystroke threshold

    Like I noted, this won't allow for every possible keystroke but it will force the learner to type in the Entry Field.  Unfortunately the triggers available when adding an action to an Entry Field are limited.

     
  • cbagby5306
    cbagby5306 Community Member Posts: 7
    Thank you, Brian!

    I think this just may work! I will test to see if I am able to add/subtract certain keystrokes.

    Casey
  • timk
    timk Community Member Posts: 1,244 ✭ Legend ✭
    My question!! If Lectora is able to set a maximum character count on an Entry field, WHERE is Lectora saving THAT count?
    The maximum length is a property of the field, it's not a variable.

    It may be easier to use the length of the entry, instead of counting keystrokes and cope with all the different keys.
  • cbagby5306
    cbagby5306 Community Member Posts: 7
    *Nerd Alert*

    I have to share. I just had a major geek moment. "Tim K replied to my question!" Hahaha!! Every time I have had an issue, I log on to the Forum, and something Tim K writes is very helpful!!

    I will open this file, and let you know what I find. Brian's way above is better than what I have been doing, but I would like to avoid having to think about the minutiae of every keystroke. Thank you!!
  • mhyden3234
    mhyden3234 Community Member Posts: 1 ☆ Roadie ☆
    edited May 24, 2021
    I need to extend the number of characters. The current limit for number of characters is 2048. I need to extend that. How can I do that? Please help :)
  • carlfink
    carlfink Community Member Posts: 1,099 ✭ Legend ✭

    I need to extend the number of characters. The current limit for number of characters is 2048. I need to extend that. How can I do that? Please help :)

    I would suggest you make this a separate question, rather than adding onto this old thread.