Skip to main content
Participating Frequently
April 22, 2016
Question

Adobe Acrobat - Hiding Text Field In PDF With Java Script

  • April 22, 2016
  • 1 reply
  • 3952 views

I have a PDF that I'm making fill-able in Acrobat. There's a coment section, where I'm doing a multi-line text field. The PDF already has horizontal lines on it for filling it out by hand.

What I want to do is have a text field over this with a white background, so that when you fill it in on a PC the horizontal lines don't show up.But I still want people to be able to fill this out by hand after they print it if they want. So if this field is left empty I want to set it to be invisible/hidden, so that when you print it the lines would be there for writing stuff in.

I've found various forums saying this is possible with the following java script:

if(this.rawValue == null)

this.presence = "hidden";

But it doesn't seem to be working.

Can anyone who knows how to do this walk me through it step by step? Maybe I'm doing it wrong. I have Acrobat X Pro and Livecycle Designer ES2, but don't know if I need to do this in designer.

Thank you.

This topic has been closed for replies.

1 reply

Inspiring
April 22, 2016

The code sample you are providing is for LiveCycle only and cannot be entered into any action in a form created with Acrobat.

With the form open, have you looked at the JavaScript console to see if there are any errors?

Participating Frequently
April 22, 2016

Is there any way to do this in Acrobat alone? I can use LiveCycle but I have a lot of PDF's to convert to fillable and it will take a bit longer If I have to edit each one with LiveCycle. I see there are ways to insert Javascript in acrobat but it seems to be in validation and calculation properties tabs for fields.

I did not notice any errors before but I will check again, thanks.

Inspiring
April 22, 2016

The following should work:

event.target.display = display.visible;

if(event.value == "")

{

event.target.display = display.hidden;

}

If you conditionally  hide the form field, you may need to make the field visible at sometime. I prefer to force the field to visible and then let the conditional statement hide it if needed.