Copy link to clipboard
Copied
Hello. I have an On Blur action for a text box that if anyone typs in the number "5012" it prompts a pop-up box that gives a message. I want to be able to change the font size and color. How can this be done. Below is my script:
var fieldValue = this.getField("Text1").value;
if (fieldValue == "5012") {app.alert("***Message to Person***");
}
Copy link to clipboard
Copied
First, put this action in the "Custom Validation" script for the "Text1" field.
Next, modify it to use the field event properties. Like this.
if(event.value = "5012"){
event.target.textColor = color.blue;
event.target.textSize = 14;
}
else{
event.target.textColor = color.black;
event.target.textSize = 12;
}
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Can't be done. There are few options for the alert box. Text color and size are not include.
You do have more options with a custom dialog. But the only color options is red or black. And the sizes are on the order of Big, Medium, and small.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
First, put this action in the "Custom Validation" script for the "Text1" field.
Next, modify it to use the field event properties. Like this.
if(event.value = "5012"){
event.target.textColor = color.blue;
event.target.textSize = 14;
}
else{
event.target.textColor = color.black;
event.target.textSize = 12;
}
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
@Thom Parker Sorry, I just realized my question was not asked very good. I want to be able to chage the color and size of the text within the pop-up box.
Copy link to clipboard
Copied
Can't be done. There are few options for the alert box. Text color and size are not include.
You do have more options with a custom dialog. But the only color options is red or black. And the sizes are on the order of Big, Medium, and small.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
@Thom Parker how do you do the customer dialog?
Copy link to clipboard
Copied
@Thom Parker yes
Copy link to clipboard
Copied
Here's the entry for custom dialogs in the Acrobat JavaScirpt Reference:
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#execdialog
Custom dialogs are complex by nature. Here's a WYSWYG tool that makes creating dialog code easier:
https://www.pdfscripting.com/public/ACRODIALOGS-OVERVIEW.cfm
Use the Acrobat JavaScript Reference early and often

