Skip to main content
Participating Frequently
April 14, 2016
Answered

Hide instructional text when printing hard copy

  • April 14, 2016
  • 2 replies
  • 1695 views

I have the following scripts in my Acrobat PDF document field properties so the Instructional Text will appear when blank, and disappears if the user types in the field.  After filling out the form, we print a hard copy, and wherever there is a blank field, the Instructional Text prints too.  How can we prevent this from printing?   Thank you in advance for your help!

// Custom Format script for text field

if (!event.value) {

  1. event.value = "Instructional text goes here";
  2. event.target.display = display.noPrint;

} else {

  1. event.target.display = display.visible;

}

// On Focus script:

if (event.target.value==event.target.defaultValue) {

  1. event.target.value = "";
  2. event.target.textColor = ["RGB", 0/255, 153/255, 51/255]; 
  3. event.target.textFont = "MyriadPro-Regular";
  4. event.target.textSize = 0;

}

// On Blur script:

if (event.target.value=="") {

  1. event.target.value = event.target.defaultValue;
  2. event.target.textColor = color.gray;
  3. event.target.textFont = "MyriadPro-It";
  4. event.target.textSize = 0; // This means Auto

}

This topic has been closed for replies.
Correct answer George_Johnson

As I indicated before, the On Focus and On Blur scripts don't work with the Format script. In using just a Format script in testing, you will be able to test just the script that sets the field to print or not, which is what you originally posted about.

2 replies

Inspiring
April 14, 2016

Also, some of the code in the On Focus and On Blur scripts don't make sense given the format script. I post the Format script as an approach to this problem, and the On Focus/On Blur script are a different approach to the same problem. The point is they should not both be used, so choose one or the other.

Coleen77Author
Participating Frequently
April 14, 2016

It appears to me that I need all three scripts (format, On Blur, and On Focus) to get the results I want.  I did some tests:  When I remove the format script, I get colored text, which is the default when someone types in the field.  I want gray Instructional Text, so I put that script back.  When I remove the On Focus and On Blur scripts, the instructional text does not disappear automatically and the new text is gray and not colored.  So I put that script back.

So do you think there is a solution to my original question?

George_JohnsonCorrect answer
Inspiring
April 14, 2016

As I indicated before, the On Focus and On Blur scripts don't work with the Format script. In using just a Format script in testing, you will be able to test just the script that sets the field to print or not, which is what you originally posted about.

Inspiring
April 14, 2016

If those lines of code actually include the "a.", "b.", etc, then each of those scripts should generate errors. That first script should be:

// Custom Format script for text field

if (!event.value) {

    event.value = "Instructional text goes here";

    event.target.display = display.noPrint;

} else {

    event.target.display = display.visible;

}

Coleen77Author
Participating Frequently
April 14, 2016

Sorry, I didn't notice the a's and b's when I pasted this into my question to you.  They weren't there to begin with and they aren't in the document scripts.

Inspiring
April 14, 2016

As a test, set up a field so that only has the Format script and not the others. Does that work?