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

Check attachments have been added before submitting.

New Here ,
Apr 21, 2023 Apr 21, 2023

Hi everyone, 

I am new to adobe and also new to Javascript and learning as i go, so any help would be fantastic. The situation is i have created a form to be sent out to customers and filled in with data required. I have a warning that will pop up when clicking the submit button which will ask to fill in specified fields that may have been missed - this works great. 

 

I have also added tick boxes asking if a picture can be provided (as an attachment in the PDF), once this box is ticked i have managed to get it to show a button, once this button is pressed it opens windows file explorer and the attachment panel in adobe.

what i am now trying to add is. If the tick box that asks if you can provide a picture (attachment) is ticked. when the submit button is pressed it will check if the PDF has had any attachments added before sending.

 

I have had the form returned to me a couple of times where a customer has ticked they can provide a picture. But not attached one. 

Thanks, 

James.

TOPICS
How to , JavaScript , PDF forms
1.1K
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 ,
Apr 21, 2023 Apr 21, 2023

In the Acrobat JavaScript model, attachements are called "DataObjects".   There is a "dataObjects" property of the document object. If it is null, then there are no attachments. 

 

For example:

if(this.dataObjects){

     ... perform submit ...

}else

    app.alert(" Please provide an attachment");

 

 

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
New Here ,
Apr 24, 2023 Apr 24, 2023
LATEST

Brilliant, Thank you! 

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