• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Document will print

New Here ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

There is a tool for "documents will print", I would like to clear all default place holders.  is this possible?

 

I found and modified this script and I added in an alert and the default values are not deleted,

 

for ( var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
var ffield = this.getField(fname);
console.println("fname: "+ fname + " - ffield.value: " + ffield.value);
if (ffield != null && ffield.value==ffield.defaultValue) {
ffield.value = "";
}
}

TOPICS
Acrobat SDK and JavaScript

Views

334

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

The code seems fine. Where exactly did you place it, and what is the result of running it?

Also, are there error message in the JS Console?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

the code is placed in the Document Actions under "Document Will Print" as I want the defaults to be cleared before it prints

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

The error I get is "InvalidSetError: Set not possible, invalid or unknown"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

You should exclude buttons and signature fields from your loop.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

this makes sense.  Dropdowns and checkboxes too?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

That's up to you, but you must exclude buttons and signatures because they have no default value.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

You are a master thanks very much for your sugestion.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

LATEST

A portion of the problem is that there are periods and spaces in the field names.  IS there a quick javascript that I can run to remove these?  There seems to be a replace function, except it doesn't seem to work with changing the names.  I found a setAttribute in regular javascript except there doesn't seem to be one in acrobat javascript.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

Interestingly enough I got a Adobe Acrobat popup saying "Do you really want to execute the script: App:Init?  Executing it could interfere with teh debugging session currently under way."

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2019 Nov 25, 2019

Copy link to clipboard

Copied

Is it possible that my onfocus behavior is conflicting with this process? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines