Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Custom Stamp with User Input Field

New Here ,
Jan 31, 2023 Jan 31, 2023

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! 

TOPICS
How to , JavaScript , PDF forms
863
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 31, 2023 Jan 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... - 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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 31, 2023 Jan 31, 2023

How would validate the field in a dialog? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 31, 2023 Jan 31, 2023
LATEST

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines