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

How can i get the values of all input after click on save button in adobe acrobate ?

Community Beginner ,
Aug 28, 2023 Aug 28, 2023

I am making javacsript plugin , here's the code , i am trying to get the input value , so i canhit a post api and send input's data into that , i tried all getfields methods and all , nothing working at all , 

function createTopMenu() {
  app.addSubMenu({
    cName: "LegalEdge",
    cParent: "File",
  });

  app.addMenuItem({
    cName: "Upload",
    cParent: "LegalEdge",
    cExec: "showUploadDialog()",
  });
}

function showUploadDialog() {
  var dialog = {
    description: {
      name: "Upload to LegalEdge",
      elements: [
        {
          type: "view",
          elements: [
            {
              type: "static_text",
              name: "File Name:",
            },
            {
              type: "edit_text",
              item_id: "fileName",
              char_width: 30,
            },
          ],
        },
        {
          type: "view",
          elements: [
            {
              type: "static_text",
              name: "Version:",
            },
            {
              type: "edit_text",
              item_id: "version",
              char_width: 30,
            },
          ],
        },
        {
          type: "view",
          elements: [
            {
              type: "static_text",
              name: "LegalEdge File Number:",
            },
            {
              type: "edit_text",
              item_id: "fileNumber",
              char_width: 30,
            },
          ],
        },
        {
          type: "view",
          elements: [
            {
              type: "static_text",
              name: "LegalEdge Court Case Number:",
            },
            {
              type: "edit_text",
              item_id: "courtCaseNumber",
              char_width: 30,
            },
          ],
        },
        {
          type: "ok_cancel",
          ok_name: "Save",
          cancel_name: "Close",
        },
      ],
    },
    commit: function (dialog) {
   

      var uploadedData = {
        fileName: dialog.store()["fileName"].value,
        version: dialog.store()["version"].value,
        fileNumber: dialog.store()["fileNumber"].value,
        courtCaseNumber: dialog.store()["courtCaseNumber"].value,
      };
      saveUploadedData(uploadedData);
    },
  };
 
  app.execDialog(dialog);
}

function saveUploadedData(data) {
  var message =
    "File Name: " +
    data.fileName +
    "\nVersion: " +
    data.version +
    "\nFile Number: " +
    data.fileNumber +
    "\nCourt Case Number: " +
    data.courtCaseNumber;
  app.alert(message);
}

createTopMenu();

can anyone look into and help me ? 
TOPICS
How to , JavaScript
566
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
1 ACCEPTED SOLUTION
Community Expert ,
Aug 28, 2023 Aug 28, 2023

The item_id values in the Dialog object must be 4 characters long. No more, no less.

View solution in original post

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 ,
Aug 28, 2023 Aug 28, 2023

The item_id values in the Dialog object must be 4 characters long. No more, no less.

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 ,
Aug 28, 2023 Aug 28, 2023
LATEST

Is this code in a JavaScript file?  Adding a menu item can only be done in a folder level script at app initialization (or from the console).  In either case the "createTopMenu" function is unnecessary.  You'll also have problems with this code in the new 64bit UI, since  the parent "File" menu has been moved to the new "Hamburger" menu, and new restrictions have been placed on creating menu items. 

 

You'll find some information on creating popup custom dialogs and a dialog designer here:

https://www.pdfscripting.com/public/ACRODIALOGS-OVERVIEW.cfm

  

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