The following script works on an Acroform as a folder level .js file, with an additional .js file to create Menu item to call the function (MyTrustedSpecialTaskFunc1), and using Acrobat Pro or Standard (not Reader)...
My question is, how would I convert this for use with a LiveCycle designed form...I have played around with it, but I seem to be missing some key step...
------------------------
/* saveAs Script */
mySaveAs = app.trustPropagatorFunction( function ( doc, path )
{
app.beginPriv();
return retn = doc.saveAs(path);
app.endPriv();
});
myTrustedSpecialTaskFunc1 = app.trustedFunction( function ( doc, path )
{
app.beginPriv();
var a = this.getField("NextPONumber");
var av = a.value;
var g = "/c/hrarchive/" + av + ".pdf"
var retn = mySaveAs(this, g);
app.endPriv();
return retn;
});
-------------------------------
Menu item script:
app.addMenuItem({ cName: "Submit Package to HR Archive", cParent: "Help", cExec: "myTrustedSpecialTaskFunc1()", nPos: 0});
--------------------------------
the field in the Designer form is: "form1.header.NextPONumber"...Thanks in advance...
Folder-level JS:
---------------------------------
/* saveAsPO Script */
mySaveAsPO = app.trustPropagatorFunction( function ( myDoc, path )
{
app.beginPriv();
var myDoc = event.target;
return retn = myDoc.saveAs(path);
app.endPriv();
});
myTrustedSpecialTaskFunc100 = app.trustedFunction( function ( myDoc, path )
{
app.beginPriv();
var a = event.target.xfa.resolveNode("form1[0].header[0].NextPONumber[0]");
var av = a.value;
var g = "/c/POSave/" + av + ".pdf"
var retn = mySaveAsPO(myDoc, g);
app.endPriv();
return retn;
});
---------------------------------------------------------
Button-script (click action) on the form:
//calls trusted function in MySaveAsPO.js folder-level script
event.target.myTrustedSpecialTaskFunc100(event.target);
-----------------------------------------------------
This saves a PDF to the specified folder, but does not name the PDF correctly...instead of naming it whatever I type into the "NextPONumber" field, (i.e. PO#1234.pdf), it names it as :
[object XFAObject].pdf
Any ideas what is going on here? Thanks in advance...