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

JavaScript Code for Attachment, Text Field & Clear files Button

New Here ,
Mar 29, 2019 Mar 29, 2019

Copy link to clipboard

Copied

Good day, Is it possible to get the Java script code to add attachment(file), Text field to show the file name that was attached  and the Clear files button to clear the text field and remove attachment. This is what i am looking for on the form i am trying to create. Any help would be greatly appreciated. Thanks

TOPICS
Acrobat SDK and JavaScript , Windows

Views

166

Likes

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 ,
Apr 02, 2019 Apr 02, 2019

Copy link to clipboard

Copied

LATEST

Yes and no. The code for adding an attachment is this:

this.importDataObject("TheObject");

This prompts the user with a file open dialog.  The name "TheObject" is the name of this attachment.

use this code to remove

this.removeDataObject("TheObject);

I've already answered a question about showing the attachment name here:

HelIo, I have an Attachment button but I would like the attachment name to show in a text box. The a...

Be aware that importing a data object can be a privileged operation, and that this code will only work in Reader if the PDF has special privileges.

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

Likes

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