Hi, im kinda new to LiveCyle 8. And ive run into a difficulty. I have a form that requests data from the user, and i want it to be able to, when it submits via email, to have the file name as [namefield]_[datefield].pdf from the contents of the form. Ive gotten the email button and all that stuff working, im just having problems naming it. Ive found a work around to autosave the file just before emailing it, with a folder level javascript. But i will not be able to use this javascript outside of my own computer and i need to be able to put it onto a website. I tried creating a script object and tried putting the JS code in there but it didnt work. Is there anyway to link the JS from the pdf file, or any other workaround for this?
Here is the code for the .js file in the acrobat/javascripts folder:
saveFunc = app.trustedFunction(function (path) {
app.beginPriv();
try {
event.target.saveAs(path);
} catch (err) {
console.println("Error: " + err);
}
app.endPriv();
});
Here is the code from the click event of my button:
var suggestedName = TextField1.rawValue.replace(" ", "_") + "_" + DateTimeField1.rawValue + ".pdf";
var cPathToSaveTo = "/c/program files/";
saveFunc( cPathToSaveTo + suggestedName );
When i tried the script object, named mySaveDoc i changed the button code to this:
var suggestedName = TextField1.rawValue.replace(" ", "_") + "_" + DateTimeField1.rawValue + ".pdf";
var cPathToSaveTo = "/c/program files/";
mySaveDoc.saveFunc( cPathToSaveTo + suggestedName );