How to Prevent a Custom Acrobat Stamp Script from Prompting Twice
Question details
The user needs to stop a custom Adobe Acrobat stamp from prompting for an input value both when selected from the menu and again when placed on the PDF.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Using a custom dynamic stamp with a JavaScript prompt (such as asking for a GL account code) in Adobe Acrobat.
- Observed behavior
- The script executes and prompts the user for input twice: once when the stamp is generated for the menu preview, and a second time when it is actually applied to the document.
Before modifying your JavaScript code, ensure you have backed up your original custom stamp PDF file and have enabled access to the Acrobat JavaScript Console.
Wrap the Stamp Script in an event.source.forReal Condition
Modify your custom stamp's JavaScript to ensure it only executes when the stamp is actively being applied to the document, skipping the menu preview generation phase.
Adobe Acrobat triggers stamp scripts when generating the visual preview for the tool menu. By wrapping your code in a specific condition that checks `event.source.forReal`, you restrict the script to run only when the user is actively stamping the page.
Place your custom stamp on a blank PDF and select it. Open the JavaScript console by pressing Ctrl+J (Windows) or Cmd+J (Mac). Run the command `this.selectedAnnots[0].AP` to retrieve the stamp's actual appearance value (e.g., STAMP_AP_VALUE).
Open your custom stamp PDF file. Navigate to the page properties or the specific form field where your JavaScript is stored, and open the script editor.
Wrap your existing prompt code inside the following if-statement: `if (event.source && event.source.forReal && event.source.stampName == "YOUR_STAMP_AP_VALUE") { /* your existing code */ }`. Replace YOUR_STAMP_AP_VALUE with the value you found in the first step.
Save the stamp PDF file and restart Adobe Acrobat. Select the stamp from the menu and apply it to a document; it should now only prompt you once.

Add Custom Stamps Easily with WPS PDF
Avoid complex JavaScript coding and double-prompt issues by using WPS Office. The WPS PDF editor offers a user-friendly interface to quickly create, manage, and apply custom text and image stamps to your documents without needing scripts.
- 1. Open your PDF: Launch WPS Office and open the PDF document you want to review.
- 2. Access the Stamp Tool: Navigate to the 'Comment' tab on the top ribbon and click on the 'Stamp' icon.
- 3. Create a Custom Stamp: Click on 'Custom Stamp' to easily design a new text or image stamp using the visual interface.
- 4. Apply the Stamp: Select your newly created stamp and click anywhere on the document to apply it instantly.

Frequently Asked Questions
Why does my Acrobat stamp ask for input when I just click it in the menu?
Acrobat generates a visual preview for the stamp menu by running the stamp's internal code in the background. If your script lacks the proper conditions, this preview generation triggers the prompt before you even place the stamp.
How do I open the JavaScript Console in Adobe Acrobat?
You can open the JavaScript Console by pressing 'Ctrl + J' on Windows or 'Cmd + J' on Mac. This console allows you to run commands like `this.selectedAnnots[0].AP` to find your custom stamp's appearance value.
What is the event.source.forReal property?
It is a property in Acrobat JavaScript that returns 'true' only when the stamp is actually being placed or printed, and 'false' when Acrobat is merely generating a preview for the drop-down menu or page thumbnails.
Can I use dynamic stamps in WPS PDF?
WPS PDF supports standard and custom image and text stamps. While it relies on an intuitive visual interface rather than Adobe-specific JavaScript for pop-up prompts, it provides simple tools for adding predefined dynamic date, time, and custom text stamps.




