Forum Discussion

JeniJohnson-19a's avatar
JeniJohnson-19a
Community Member
6 years ago

Minimum number of characters required

For text entry, is there a way (maybe with Javascript) to make a user enter a minimum number of characters before they can move on? To prevent them from typing in one character just to click next. 

 

 

  • rajakrishna's avatar
    rajakrishna
    Community Member

    For Text Area: $('textarea').attr("maxlength",10)

    For Input: $('input').attr("maxlength",10)

      • JeremyStump's avatar
        JeremyStump
        Community Member

        Hi, could you provide an example of how to set the maximum character length? I am having a tough time figuring this out.

    • EmmabelAgustin's avatar
      EmmabelAgustin
      Community Member

      Hello, how can I apply this? I've been trying this code by Execute Javascript trigger when timeline starts, but it's not working. 

  • HanaSedlakov's avatar
    HanaSedlakov
    Community Member

    Hello Matthew,
    I wanted to ask if there is already an option to bypass saving the text in a variable, so that I don't have to click outside and can count characters directly as I type?

  • The short answer is no. A more difficult option might be to capture individual keystrokes and use JS to build up the text. I imagine that would take more work and triggers than it would be worth.