I am trying to put a save button on a livecycle document. It will create a filename based on some fields in the form.
I understand that I have to do this using a trusted function.
The example I found as a basis has the trusted function defined as:
var MySaveAs = app.trustedFunction( function(oDoc,cPath,cFlName)
// Ensure path has trailing "/"
cPath = cPath.replace(/([^\/])$/, "$1/");
oDoc.saveAs(cPath + cFlName);
app.alert("Error During Save");
and has the call defined like:
The reason I think this doesn't work, is that "this" in a static pdf form is a document object, and "this" in a livecycle form is the current object, which in this case is a button
("oDoc.saveAs is not a function" is the error I get in the console).
When you get to saveAs, oDoc is an XFA object and an xfa.Button doesn't have as saveAs method.
So the question is: What do I put as the first parameter in the call that is the current document object, so that the trusted function gets an object Doc and not an object XFAObject? Or is that my problem?