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

Custom Stamp with User Input Field

New Here ,
Jan 31, 2023 Jan 31, 2023

Copy link to clipboard

Copied

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

Views

483

Translate

Translate

Report

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

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

How would validate the field in a dialog? 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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