AcroForm mySaveAs throwing an error : UnsupportedValueError: Value is unsupported
I'm new to javascript. I've browsed the forum and tried every solution that I've come across here and yet still stuck with the mySaveAs function giving me the same error no matter what my button script is in my AcroForm. I'm not able to figure out how to resolve this error. Appreciate all the help and assistance. Thanks in advance.
ERROR:
UnsupportedValueError: Value is unsupported. ===> Parameter cPath.
Doc.saveAs:7:Field Save:Mouse Up
Below are my Scripts.
Folder level script:
var mySaveAs = app.trustedFunction(
function(doc,path) {
app.beginPriv();
doc.saveAs(path);
app.endPriv();
}
);
myTrustedSpecialTaskFunc = app.trustedFunction(
function(doc,path) {
app.beginPriv();
try {
mySaveAs(doc,path);
} catch (e) {
app.alert("Error During Save - " + e);
}
app.endPriv();
}
);
Mouse-up Button script:
//
// Before saving the data, make sure that all required
// fields are valid
//
function myDateSTring(){
return util.printd("mm/dd/yyyy h:MMtt", new Date());
}
if(FormValidFields())
{
var directory = "/C/Users/aUsers/Folder/Subfolder/";
var SignedOffBy = this.getField('SignedOffBy');
if (this.getField("SignedOffBy").value == "SignedOffBy.valueAsString"){
SignedOffBy = SignedOffBy.valueAsString;
}
var myFileName = SignedOffBy + " - " + myDateSTring() + ".pdf";
var mySaveAs = directory + myFileName;
if (typeof(mySaveAs) == "function") {
mySaveAs(this, directory, SignedOffBy +"-"+ myDateSTring()+".pdf");
app.alert("This Form " + SignedOffBy +"-"+ myDateSTring()+ " has saved successfully to the following location: /C/Users/aUsers/folder/subfolder/" , 3);
} else {
app.alert("Missing Save Function. Please contact forms administrator ");
}
}
