How do I pass a form value to the file name defined in the security context?


hi all,

 

still learning javascript... have javascript saving copy of pdf location on machine. got trust privileges working well.

 

how pass in field values filename? right now, pdf copy created named [object field].pdf . instead, want use dynamic values within form itself.

 

while this.documentfilename gets me name of file (code in trusted folder)...

  var mysavedoc = app.trustedfunction(function(doc, subname) {
  
   app.beginpriv();
   var mypath = "/c/subinspectionforms/" + this.documentfilename + ".pdf";
   
   // saveas privileged code needs enclosed
   // beginpriv/endpriv
   doc.saveas({cpath: mypath,
   bcopy: true,
   bprompttooverwrite: true});
   app.endpriv();

  });

 

this.getfield("inspection_location") not me value of field:

 

  var mysavedoc = app.trustedfunction(function(doc, subname) {
  
   app.beginpriv();
   var mypath = "/c/subinspectionforms/" + this.getfield("inspection_location") + ".pdf";
   
   // saveas privileged code needs enclosed
   // beginpriv/endpriv
   doc.saveas({cpath: mypath,
   bcopy: true,
   bprompttooverwrite: true});
   app.endpriv();

  });

 

the script on saveacopy button this:


var subname = this.getfield("inspection_location");

mysavedoc(this, subname);

 

 

 

do need pass field value function?

 

 

it's easy assume "this.getfield" universal thing can use, isn't. please read description of "this" object carefully. defined in contexts, , don't think allowed use it. must pass parameter context defined.



More discussions in PDF Forms


adobe

Comments

Popular posts from this blog

after effects warning: unable to create drawing surface

Maximum number of authorizations reached!