Set minimum number of characters.

  • Profile Image
    penforhiregraphics
    Asked on January 30, 2013 at 05:09 PM

    My client wants a phone number where you have to put 3 digits in for the area code and 7 for the phone number.  The Phone Number quick form allows for more so I used text boxes for each part defined as number with a Max of 3 and a Max of 7.  But they want it set that you have to put at least 3 and 7.  I followed this:

    http://www.jotform.com/answers/54587-How-do-I-ensure-that-users-enter-no-less-than-a-certain-number-of-characters-into-a-text-box

    Adding the min="3" as suggested stops the Next Button to stop working. My form is here:

    http://routemyfleet.com/

    I copied the source code and added the min="12" and then pasted it on my page using Adobe Muse as an html obeject.  Next works fine until I do this.

    Any thoughts?  Would be nice as a standard feature to have Min and Max instead of just Max.

    Thank you,

    Gary

  • Profile Image
    abajan
    Answered on January 30, 2013 at 09:24 PM

    Hi Gary,

    According to my information, the min attribute has to do with the value of a number and not how many digits it contains and unfortunately, there's no minlength attribute. However, HTML5 has a pattern attribute where if a user were to enter less than the required number of digits, a message would be triggered.

    It's also possible to add a script that forces the user to enter the phone number in the correct format, as illustrated in this demo.

    Please let us know if you need further assistance with this.

    Thanks.


    Wayne

  • Profile Image
    abajan
    Answered on January 30, 2013 at 09:33 PM

    Gary,

    I forgot to mention that the pattern attribute doesn't work in IE unless the workaround described in the following video is applied: