[warning: newbie]
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)
{
app.beginPriv();
// Ensure path has trailing "/"
cPath = cPath.replace(/([^\/])$/, "$1/");
try{
oDoc.saveAs(cPath + cFlName);
}catch(e){
app.alert("Error During Save");
}
app.endPriv();
});
and has the call defined like:
MySaveAs(this,cPath, "filename"); |
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?
Thanks,
Jon
Solved! Go to Solution.
Views
Replies
Total Likes
You are right in your analysis that "this" has a different value in XFA documents and AcroForm documents.
You should be able to use
MySaveAs(event.target,cPath, "filename");
in an XFA form instead.
For more information take a look at the documentation.
Hope that helps,
Martin
Views
Replies
Total Likes
You are right in your analysis that "this" has a different value in XFA documents and AcroForm documents.
You should be able to use
MySaveAs(event.target,cPath, "filename");
in an XFA form instead.
For more information take a look at the documentation.
Hope that helps,
Martin
Views
Replies
Total Likes
Thanks Martin,
I think it would have taken me a long time with the documentation to work that out, though.
Jon
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies