PDF Editing Issues

How to Display Part of an Acrobat Alert Message in Red in PDFs

Tauseeq MagsiTauseeq Magsi Oct 28, 2026 869 views

Question details

The user wants to format a specific portion of a PDF form error message in red using the app.alert script.

How to Display Part of an Acrobat Alert Message in Red in PDFs
Product
Adobe Acrobat / PDF Forms
Device & OS
not provided
Scenario
Creating an interactive PDF form script where an error message needs to alert the user with mixed text colors.
Observed behavior
The standard Acrobat app.alert function outputs plain text and leaves the remaining text in the default color, failing to apply the requested rich-text formatting.
Before you start

Ensure you are using a PDF editor with form authoring and JavaScript execution capabilities, and verify that your document is saved as an interactive PDF form.

Solution 1Recommended

Use an Interactive Rich Text Form Field

Since app.alert cannot display rich text, you can use a hidden form field on the PDF that appears with formatted red text when an error occurs.

The standard Acrobat JavaScript app.alert method only processes plain text strings. To show colored text, you must rely on objects within the PDF that natively support rich-text formatting.

1
Add a new text field

Open your PDF in form editing mode and insert a Text Field near the area where the user inputs data.

2
Enable rich text formatting

Right-click the newly created text field, select 'Properties', navigate to the 'Options' tab, and check the box for 'Allow Rich Text Formatting'.

3
Update your validation script

Modify your PDF script so that instead of calling app.alert, it changes this text field's visibility to visible and assigns the specific red-colored formatting to its richValue property.

Use an Interactive Rich Text Form Field
Better User Experience: Using in-document fields for error messages is often less intrusive than pop-up alerts and allows for fully customized typography and branding.

Edit and Manage PDF Forms with WPS Office

If you need to create, edit, or fill interactive PDF forms without dealing with complex JavaScript workarounds, WPS Office provides an intuitive suite of PDF tools that simplify document management.

  1. 1. Open your PDF in WPS Office: Launch WPS Office and open your interactive PDF document using the WPS PDF tool.
  2. 2. Access form tools: Click on the 'Form' tab in the top navigation bar to reveal all interactive form control options.
  3. 3. Customize form properties: Double-click any text field to adjust its appearance, text color, and formatting options directly from the properties panel.
Easily add, edit, and manage interactive PDF form fields.High compatibility with standard Adobe PDF formats.Lightweight, fast, and features a user-friendly interface.Rich text editing and formatting tools built directly into the PDF editor.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use HTML tags inside an Acrobat app.alert?

No, the standard Acrobat app.alert function only accepts and renders plain text. Any HTML tags included in the string will be displayed as raw text rather than formatted content.

Why does my PDF script fail when trying to change alert text color?

The app.alert method in PDF JavaScript API does not have parameters or properties for text color or font styles. The API relies on the default system or application UI rendering.

How do I make a text field visible only when an error occurs?

You can set the form field's initial property to 'Hidden'. Then, in your validation script, use JavaScript to change the field's 'display' property to visible (e.g., display.visible) when the error condition is met.