• Resolved shawnm1


    I’m trying to make a field that:
    • Requires the user to enter a number
    • Requires the number to be a certain number of digits, example: 5 digits
    • Will accept numbers with leading zeros, example: 01234 = 5 digits

    Lets use an employee ID# as an example. Some employee ID’s could be: 01045, 12345, 98076, all of which being valid.

    How can I go about this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author EDGARROJAS



    I think you can do a ‘formula’ validation (section 3 of https://sfmanual.rednao.com/documentation/conditional-logic/doing-calculations-in-conditional-logics/) which has a code like this:


    That should validate that the number has a maximum of 5 digits. You could also use a numeric field to allow only numbers.


    Hello! Thank you for your reply!
    Here’s the validation code I’m using on a number type field: String(ID_field).length<5

    I actually got that from an earlier support thread we had. Reference here:

    The problem I’m having is that the above works, except if the number begins with a zero, example: 01234.
    I think it’s got something to do with converting the field to a string, but I’m not sure. I do see though that the code above is a bit different, so I’ll try that to see if it works.



    [field].toString().length=5; doesn’t seem to do anything

    String(field).length=5 gets it to validate, but ignores leading zeros

    Plugin Author EDGARROJAS



    Sorry for the delay, please try something like this:


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Form Validation’ is closed to new replies.