Acrobat Adobe - Common Pulling Script
Hello,
I am working with Acrobat Adobe XI. I am naming field names so that they self populate throughout the document that I am working on. One of my values, Unique ID, is comprised of "purch_order""-""clin""-""body_sn". I was able to make a script that will pull the values for Unique ID from their respective fields and populate in the appropriate order.
Script:
event.value = this.getField("purch_order").value.toString().replace(/0/,"") + "-" + this.getField("clin").value.toString().replace(/0/,"") + "-" + this.getField("body_sn").value.toString().replace(/0/,"");
More info:
Script is used for the field name Unique ID
purch_order = Purchase Order
clin = Item Number
body_sn = Serial Number
The Problem:
The issue with my script is that it does not allow for leading and trailing zeroes. For the purchase order and serial number, I need to keep the leading and trailing zeroes included as they are part of the Unique ID. For the line item, I only need to keep the trailing zeroes, and I cannot keep the leading zeroes. For anyone wondering, the purchase order is comprised of 10 numbers/letters. The item Number is comprised of four numbers. And the serial number is comprised of 5 numbers/letters. I am defining numbers as 0-9. And letters as A-Z. Does anyone know how I can write a script within my script for each field name to keep/remove the trailing and leading zeroes that I require?
Any ideas would be much appreciated!
Thanks,
Michelle
