I am new to writing JavaScript for PDF's and am looking for some help with a problem I have been trying to solve.
The scenario:
I have multiple text fields that have their own unique values. However, there is one text field called "serial number" that has the same value on multiple areas of the PDF.
I have chosen to make a separate text field with it's own name. I know that you can have many of the same instances with the same name and it'll automatically populate the value throughout the document. I did not want it to work like this because the other instance(s) needed to be "read-only". These text fields have a maximum character limit of "18" and a minimum of "11". Here is the JavaScript I wrote to handle this task:
/* on Blur */
var sNum = this.getField("SERIAL1");
var cNum = this.getField("SERIAL2");
if (event.value.length < 11)
{
var msg = "Please enter more than 11 characters for the serial!";
app.alert(msg, 1, 0, "Character Limit Error");
sNum.fillColor = color.red
cName.value = "";
}
else
{
sNum.fillColor = color.transparent;
cNum.value = sNum.value;
}
/*end code*/
Well, it works... kind of. The problem I am running into is that the cNum (SERIAL2) value doesn't have the correct value if it is an all number value. However, if I add in an ASCII character, it works perfectly.
Is there a way to convert the text fields to display the true value?
Does any of this even make sense? ;)
Any help would be appreciated!
Regards,
Ron
George