Skip to main content
Participant
January 31, 2023
Question

Custom Stamp with User Input Field

  • January 31, 2023
  • 1 reply
  • 1034 views

Hello, 

 

I have created a custom dynamic stamp with a pop-up user input field, however I need to make it so the input field cannot be left blank. There has to be a value entered. Any help is appreciated! 

 

Thanks! 

This topic has been closed for replies.

1 reply

Karl Heinz  Kremer
Community Expert
Community Expert
January 31, 2023

The problem is that once the pop-up shows up, the samp is already placed, and you are just filling in the field, this means that there is no way to cancel the stamp at this time. There are a few things you can do: If you replace your popup with a dialog, you can then validate the field and if it's left emtpy, display a message, instructing the user to select the stamp, remove it and apply it again. This relies on the user to do the steps in the correct order and actually follow through. Another option, but a lot more involved is to still display the message, but then in JavaScript create a timer function when the field was blank that will remove the last stamp after a short time. This is probably not something you want to do if this is the first stamp you are creating. If you want to learn more about stamps, how they work and what you can do with them, consider getting Thom Parker's book: https://www.pdfscripting.com/public/All-About-PDF-Stamps-in-Acrobat-and-Paperless-Workflows-The-Book.cfm - his subscription based web site pdfscripting.com also has a ton of useful information. I am not getting paid to say this, I am just somebody who has benefitted from Thom's knowlege many times over the years. 

Participant
January 31, 2023

How would validate the field in a dialog? 

Thom Parker
Community Expert
Community Expert
January 31, 2023

If the current script uses a response popup, it can be put into a while loop that checks the value.  

 

 

var cRtnTxt;
do{
   cRtnTxt = app.response(...);
}while(cRtn == "");

 

 

 For a custom popup dialog, you'd need to learn a bit about how they work. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often