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

Text field value - leading zeros dropped upon copy to another field

marklorenz
Registered: May 6 2009
Posts: 14
Answered

I have a text field that has numbers entered. There can be leading zeros (e.g. "010"). Fine so far. However, when the field loses focus (on blur), I run a JS to copy the value to a read only field elsewhere in the document. This script does NOT get any leading digits. I need the entire set of digits ("010" in my example) copied to the 2nd field (it's a phone # and unfortunately the document has the area code, exchange, and extension broken out into three fields, so I can't indicate it is a phone number).

I have tried custom keystroke script, custom validation script, custom calculation script, ... all to no avail. I can't believe no one has an issue with a set of digits dropping leading "0"s. My script that does the copying doesn't even see the entire string ("010"), but just the truncated one if leading zeros ("10").

Can anyone help??
Thanks, Mark

My Product Information:
Acrobat Pro 8.1, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Have you tried to use the 'valueAsString' property or the 'toString()' method?

Make sure the fields are not numeric or the leading zeros will be removed.

George Kaiser

marklorenz
Registered: May 6 2009
Posts: 14
Found the answer in the Javascript manual -- using valueAsString instead of value retains the leading zeros! Hope this helps someone else...