These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How to ensure numeric field custom format

pramod_kmr73
Registered: Mar 11 2008
Posts: 25
Answered

I have developed a form in Acrobat 8 Prof.

(a) Theree are text field where i need the user to key in some number. The field lenght is 6. Now the requirement is to ensure that the field is populated with the numeric value keyed in by the user prefixed with zeros. i.e if the user key in 63 , the value in the field should be displayed as 000063. if he keys in 125 the value should be displayed as 000125.

pramod

My Product Information:
Acrobat Pro 8.1.2, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You have to use the "Custom" format option on the "Format" tab and provide the "Custom Keystroke" and "Custom Format" scripts.

The keystroke code uses the RegExp test to validate input keystrokes and set the event's return code:

event.rc = /^\d{0,6}$/.test(event.value);

The format code uses the "util.printf()" method to format with the leading zeros:

event.value = util.printf("%,306d", event.value);

George Kaiser

pramod_kmr73
Registered: Mar 11 2008
Posts: 25
Thanks for the reply , it works

No how to custom validate a fied having a combination of number 5 digits and alphanumeric 4 digits ( 4th digit may be spaces ) ex "00125123T" or "00126121 " . The field value must be of minimum eight characters and the maximum possible is nine characters. if the user omits the leading zeros the same are to be prefixed.

pramod