I have created a fillable form with a submit button to send the PDF via email as attachment with recipient email address information. It works fine at my end, but when friend clicks on submit button, a popup window says "Please indicate the option that best describes how you send email". I dont get this window when I click - and we don't want ANY popup windows. Here is link online to this form: username is ambrosia, password is wholesale.
File attachment rights for the end user is a security-restricted method that requires advanced scripting described in the Acrobat SDK.
Try this alternative:
This example takes the response given in a text field and appends it to an attached document (text file attached to the PDF doc). (Perhaps this document is circulating by email, and the user can add in their comments through a multiline text field.)
There are four methods used in this JavaScript.
var v = this.getField("myTextField").value;
// Get the contents of the file attachment with the name "MyNotes.txt"
var oFile = this.getDataObjectContents("MyNotes.txt");
// Convert the returned stream to a string
var cFile = util.stringFromStream(oFile, "utf-8");
// Append new data at the end of the string
cFile += "\r\n" + v;
// Convert back to a stream
oFile = util.streamFromString( cFile, "utf-8");
// Overwrite the old attachment
this.setDataObjectContents("MyNotes.txt", oFile);
// Read the contents of the file attachment to a multiline text field
var oFile = this.getDataObjectContents("MyNotes.txt");
var cFile = util.stringFromStream(oFile, "utf-8");
this.getField("myTextField").value = cFile;
My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.