My learning of scripting the PDF Forms.
Instead of adding items manually using the properties dialogue box, use the following script to add the list items at one go.
var l = [" ", "a", "b", "c", "d"];
var lst = this.getField("Dropdown1");
lst.setItems(l);
Multiple dropdown menu having the same content can be created repeating the definition and setItems.
Choosing the export value to fill the text field. Use the mouseup action of the checkbox to run the script.
var check = (this.getField("Checkbox1").valueAsString=="Yes") ? "Select" : "Unselect";
this.getField("Text1").value = check;
}
Text field with default value displayed in gray, when the field is filled, the custom format script is executed.
if(event.value=="")
{
event.value="File Name";
event.target.textColor = color.gray;
}else
{
event.target.textColor = color.black;
}
Run the custom validation script.
var email = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
if (event.value!="")
{
if (!email.test(event.value))
{
event.rc = false;
app.alert("\"" + event.value + "\" is not a valid email address.");
};
};