Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to set a minimum number of digits in a number field?

New Here ,
Jun 28, 2018 Jun 28, 2018

Setting a maximum is pretty straight forward, but I don't see an option in Acrobat 2017 for configuring a minimum number of digits in a number field. We have a form which requires a bank routing number (9 digits) and users habitually either ad an extra digit or leave one out. This happens most often when there are more than a few consecutive zeros in a row. Thanks for the help in advance.

TOPICS
PDF forms
4.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
LEGEND ,
Jun 28, 2018 Jun 28, 2018

What a appears as a series of digits maybe considered as a number or a character string of digits. Numbers are used in calculations and PDF forms have some strict requirements for this type of data. It can only consist of a sign, the digits 0-9, and a single decimal point. If it does not meet these standards, then the value is Not a Number (NAN) and cannot be used in a calculation.

Certain strings of numeric digits can be used in special text fields like the U.S. Social Security Number (SSN), time in one of many formats, U.S. Postal Zip Codes in 5 or 9 digit format. Numeric digits appearing in a field or variable are usually converted into the floating point format which is a a way to compactly store numeric data but unlike a string, it has no defined length unless forced to the string format using the String constrictor of string concatenation.

When accessing a field like the SSN that may have leading zeros, one needs to use the "valuesAsStirng" property and that property will convert the field value into a Sting type of value and that value will have a length. Note that the fields line SSN, Phone Number, Postal Zip Code, etc all have no separater characters in the stored value. You may find that even with the arbitrary mask you will need to use the "valueAsSting property for accessing the field.

Create a text field as above for a field named "Text1" and then run the following script in Acrobat's JavaScript console:

var nValue = this.getField("Text1").value;

console.println("Value: " + nValue + "/ntype of: " + typeof nValue);

var cValue = this.getField("Text1").valueAsString;

console.println("Value: " + cValue + "/ntype of: " + typeof cValue);

To see the differences in the two types of field properties.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2018 Jun 28, 2018

Go to the field's Properties, Format tab, select Special, then Arbitrary Mask, then enter nine 9's as the mask.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 28, 2018 Jun 28, 2018

What a appears as a series of digits maybe considered as a number or a character string of digits. Numbers are used in calculations and PDF forms have some strict requirements for this type of data. It can only consist of a sign, the digits 0-9, and a single decimal point. If it does not meet these standards, then the value is Not a Number (NAN) and cannot be used in a calculation.

Certain strings of numeric digits can be used in special text fields like the U.S. Social Security Number (SSN), time in one of many formats, U.S. Postal Zip Codes in 5 or 9 digit format. Numeric digits appearing in a field or variable are usually converted into the floating point format which is a a way to compactly store numeric data but unlike a string, it has no defined length unless forced to the string format using the String constrictor of string concatenation.

When accessing a field like the SSN that may have leading zeros, one needs to use the "valuesAsStirng" property and that property will convert the field value into a Sting type of value and that value will have a length. Note that the fields line SSN, Phone Number, Postal Zip Code, etc all have no separater characters in the stored value. You may find that even with the arbitrary mask you will need to use the "valueAsSting property for accessing the field.

Create a text field as above for a field named "Text1" and then run the following script in Acrobat's JavaScript console:

var nValue = this.getField("Text1").value;

console.println("Value: " + nValue + "/ntype of: " + typeof nValue);

var cValue = this.getField("Text1").valueAsString;

console.println("Value: " + cValue + "/ntype of: " + typeof cValue);

To see the differences in the two types of field properties.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2021 Oct 28, 2021

Hello! I found this article that was the most helpful for me. https://community.adobe.com/t5/adobe-sign-discussions/data-validation-in-form-field-adobe-sign/td-p/...

Your issue appears to be similar, so, I wanted to share because finding an answer to this question did take some time searching. 

 

The basic idea is that in the field you choose Custom - Regular Expression for hte Validation and then use the expression ^\d{4}$

where:

  • ^ = The start of the string, preventing some number of characters before the expression value
  • \d = Digits, or 0-9
  • {4} = four of them. No more, no less
  • $ = Ends of the string, preventing four numbers, and then any other characters

Note: this type of validation is only available at the Business and Enterprise levels of service.

 

Hope this helps others!

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2021 Oct 28, 2021
LATEST

This only applies to Adobe Sign forms, not regular PDF forms (although it can be achieved there, too).

Note also that this validation will probably prevent you from clearing the field entirely...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines