Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

210
Visualizações
How to prevent overwrite in acrobat form if it has the same file name created from form fields with automated mysaveas

UPDATED 1/5/2022: We have an adobe acrobat form in which we created a "Save to share drive" button and have the completed form save to a designated folder on a share drive and create a file name based on certain fields in the form. We added a .js file to the javascript folder in the C: program files to allow save as. All of that is working fine HOWEVER if another person comes along and completes a form and selects the same fields, then the file name could be the same. The code prompts the 2nd user to overwrite file with same name or not, but it doesn't let you execute the not overwrite function.

How can we either altogether prevent an overwrite or do a saveAs with a slightly different name like with a (2) after it? We get the pop up saying "the file XXNAME already exists, Do you want to replace it?" If you click Yes on the pop-up, it overwrites the existing file. If you click No, it doesn't overwrite, but you get this message: "NotAllowedError: Security settings prevent access to this property or method. Doc.saveAs:3:Field SaveToShareDrive:Mouse Up"

Here is the JavaScript code saved in a .js file in the program files:

mySaveAs = app.trustPropagatorFunction(function(doc,path) { app.beginPriv(); doc.saveAs({cPath: path, bPromptToOverwrite: true}); app.endPriv(); })   

myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path) { // Privileged and/or non-privileged code above app.beginPriv(); mySaveAs(doc,path); app.endPriv(); // Privileged and/or non-privileged code below });

Here is the JavaScript code on the "Save to Share Drive" button in the form itself:

// build file name
var myFileName = getField("CaseNameInRegardsTo").value + "-" + getField("Classification").value + "-" + getField("IrType").value + "-" +
getField("Initial").value + "-" + getField("SpecialRqstProgram").value + "-" + getField("SpecialRequestType").value + "-" + getField("ReportCounty").value + "-" +
getField("CompanionReports").value + "-" +
getField("SensitiveCase").value +
".pdf";
 
// add folder name
myFileName = "/S/swi/downtime/" + myFileName;
myTrustedSpecialTaskFunc(this, myFileName);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Hello Juan, I'm having an issue while running Button script. In javascript Debugger shows an error which is: ReferenceError: myTrustedSpecialTaskFunc is not defined 5:Field:Mouse Up

Is there anything missing in my javascript.

var myFileName = this.getField("bm1").value +"-" + this.getField("bm2").value +"-" + this.getField("bm3").value +"-" + this.getField("bm4").value +"-" + this.getField("bm5").value+ "-" + util.printd("dd-mm-yyyy hhmm", dt)+ ".pdf";

myFileName = "/c/test/" + myFileName

myTrustedSpecialTaskFunc(this, myFileName);

app.alert("This Form ( "+myFileName+" ) has saved successfully to the following location: /C/test/" , 3);

about 4 years ago · Sohail asif Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda