2 Replies Latest reply on May 11, 2014 2:09 AM by try67

    What is the JavaScript to copy the value from a field to the clipboard?

    h2oloigst

      I have a "Save As" Button scripted. But would like the button to first copy the value "SiteCode" so when the user is prompted to enter in the name they can just paste it.

       

      Anybody got any ideas?

       

      Thanks

        • 1. Re: What is the JavaScript to copy the value from a field to the clipboard?
          George_Johnson MVP & Adobe Community Professional

          That's not possible. It is possible to save to an existing folder with a filename derived from one of more field values, but the code that does that save has to be in a folder-level JavaScript file or in a certified document that the user chooses to trust for privileged JavaScript execution. So each user would have to manually install the JavaScript file or manually add the certificate to their list of trusted certificates and specify that it's trusted for privileged JavaScript execution.

           

          I've had good success providing instructions for copying the field name from a form field so that the user can paste it as the field name in the Save As dialog that's invoked using an "Execute a menu item" action (File > Save As), so this might be a viable alternative you can use.

          • 2. Re: What is the JavaScript to copy the value from a field to the clipboard?
            try67 MVP & Adobe Community Professional

            Another alternative I like to use is an alert window, displaying the "recommended" file-name, just before the file is being saved.

            The user can then simply copy that file-name and paste it into the Save As dialog. It's even possible to show an error message of some kind if they didn't save the file using the recommended name.