Avatar

Level 10

Bingo!!

My mistake; I was adapting my script to suit your application and missed one of the references:

// folder level JavaScript to allow Save As population of file name

mySaveAs = app.trustPropagatorFunction(function(myForm, path)

{

     app.beginPriv();

     var myForm = event.target;

     return rtn = myForm.saveAs(path);

     app.endPriv();

});

myTrustFunct = app.trustedFunction(function(myForm, path)

{

     app.beginPriv();

     var proNr = event.target.xfa.resolveNode("topmostSubform[0].Page1[0].Last_Name[0]").rawValue;

     //console.println("proNr: " + proNr);

     var vProNr = proNr.toString();

     var vPath = "/c/HSSSave/HSS Foot & Ankle for Patient " + vProNr + ".pdf";

     //console.println("vPath: " + vPath);

     var retn = mySaveAs(myForm, vPath);

     app.endPriv();

     return retn;

});

Also I would remove the click script at the end of the .js file (copy attached).

Also note that if the "last name" field is blank, it won't save the form, so an if statement might help. Once the last name is provided, the form saves in the folder with the specific name.

Good luck,

Niall