5 Replies Latest reply on Oct 20, 2011 1:45 PM by jabberpunch

    Need some help with button JavaScript for Save As event.

    jabberpunch Level 1

      Hi,

      I'm using Adobe Acrobat X Pro and am completely new to scripting forms in Adobe (completely new to Adobe Acrobat as well!).  On a form there is a save button that opens the Save As dialog by using a trigger (Mouse Up) and action (Execute a menu item - File>Save As...>PDF...) and this works fine, however, I want to now use javascript to modify this button's behavior so that is uses a trigger (Mouse Up) and action (Run a JavaScript), and I want that JavaScript to combine the text values from two form fields (a location Dropdown and a date Text field) and use this concateneated string + ".pdf" as the filename when it opens the Save As dialog.  Make sense?

       

      This is what I have added to the button as a JavaScript so far I am using a test string at the moment ("NewFile.pdf") and will add the concatenated string to the script after I know the script is working as it should.

       

      var newFileName = "NewFile.pdf";

      var pathArray = this.path.split("/");

      pathArray.pop();

      pathArray.push(newFileName);

      this.saveAs(pathArray.join("/"));

       

      Two issues so far:

      1. When I click the button nothing happens, no Save As dialog or anything. 

      2.When I check the button properties under the Actions tab the Select Action property shows "Execute a menu item" even though I previously selected "Execute a JavaScript"

       

      Thanks for any help!