Copy a validation java script into multiple fields
Hi,
I have a PDF form which acts as an inspection report for a manufacturing process at my work. I am trying to digitise the report so they can use a tablet instead of hand writing and then scanning the documents into our system.
I have a simple validation script which turns the entered text into red for certain values:
function if (event.value=="WORN") event.target.textColor = color.red;
else event.target.textColor = color.black;
However i am not having much luck copying this script to all the text fields on the document (over 200 fields).
I have tried the solution outlined in this thread: faster way to copy a validation java script into multiple fields, i have set a Document JavaScript called validateField, i have then put the following script into it:
function validateField()
{
function if (event.value=="WORN") event.target.textColor = color.red;
else event.target.textColor = color.black;
}
But when i run the JavaScript console it just adds validateField() into the Text Fields custom validation script section and not the script above. This is what i am running the the JavaScript Console:
for (i=1; i<=200; i++)
{
this.getField("Text Field Condition.1."+i).setAction("Validate",'validateField()');
}
Am i missing something?
Regards,
Tim
