Is there a way to make a field a set number of characters/digits?

  • Profile Image
    Asked on May 30, 2013 at 07:51 PM

    I have a field on my form for clients to enter their AAA number. The number is always 16 digits in length. I have instructions that advise them to be sure to give all 16 digits, but sometimes they don't, then their information is useless. I'd like to have a way to make the field be rejected if they enter a card number of the wrong length. So if they enter 6 digits or 15 or 7 or whatever, the form would reject the submission and point them back to correct the field.


    BTW, the field cannot be made mandatory, because not all clients have AAA cards. However, for clients who DO have the card, I need to be sure that the correct number of digits is entered on a mandatory basis, otherwise, they are just wasting their time. A wrong card number will not serve any purpose.

  • Profile Image
    Answered on May 30, 2013 at 10:56 PM

    Actually, if a condition is attached to the field to only show it when the preceding field ("Member of AAA ...") is not equal to "No", it can be made mandatory. (If a field is set to "Required" but is hidden, the form can be submitted without that field being filled.)

    The "AAA # ..." field can be set in the form builder to only accept digits by clicking it, clicking the Validation button and selecting Numeric:

    However, since the Conditions tool currently has no "check length of entry" functionality, the only way to ensure that users enter exactly 16 digits would be to get a copy of the form's full source, embed it into a web page and add a short script to the said page.

    I'll clone the form and work on a solution and get back to you.

  • Profile Image
    Answered on May 31, 2013 at 12:27 AM

    Hi again

    If the functionality demonstrated at this link is okay, please load your form in the form builder (editor) and do the following:

    1. Click the AAA # (please include all 16 digits): field and
     a. Set it to "Required"
     b. Click the Validation button and select Numeric, as explained above
     c. Click the Max Size button and enter 16


    2. Click the Setup & Embed tab > Conditions > Next

    3. Create the following condition and save it: 

    4. Save the form

    5. Copy the form's source and paste it into the body of a web page of your choice

    6. Copy this code and paste it into the same page, anywhere after the form's code (preferably, just before the page's closing body tag, as in the source of my demo)

    That should do it but if you would like clarification on anything or experience any difficulties, please let us know.


  • Profile Image
    Answered on August 11, 2013 at 09:21 PM

    I have a similar requirement, but I am validating the length of a cell phone serial number. It can only be 3 different lengths: 8, 11, or 14 characters. How do I modify the suggested code to fit my situation?

  • Profile Image
    Answered on August 11, 2013 at 09:36 PM

    Hello wireleddunltd,

    Kindly open a new thread so we can better track the issues and solutions users are having.
    To assist you better and avoid confusion.
    Thank you and looking forward to assist you.
  • Profile Image
    Answered on August 11, 2013 at 09:45 PM

    Thank you. I just submitted it to the forum as a new question.

  • Profile Image
    Answered on August 11, 2013 at 10:12 PM

    Hello wirelessunltd,

    I have replied on your thread here

    Kindly do this everytime you have any inquiry.

    Thank you so much.