Skip to main content
Princeplanet
Inspiring
June 28, 2018
Answered

How would one keep a text field transparent unless it is populated, in which it would be opaque?

  • June 28, 2018
  • 1 reply
  • 890 views

I have a form that I will use as a fillable form or a stand alone printed document. 

As a stand alone document, I have on a page multiple lines that would be used to write one's thoughts about a particular subject.

As a fillable form I have a text field covering the area with the lines.

What I would like to have happen when I use that document as a fillable form is that if NO text is entered in the field, I would like that field to be transparent, thus showing the lines (that they could easily write in at a later date once the form is printed). If I enter text, I would like the field to be opaque and NOT show the lines behind it.

Is that easily done?

I'm using Acrobat 2017

Thanks for your patience and help

This topic has been closed for replies.
Correct answer Princeplanet

Thank you, Thank you, Thank you!

1 reply

Known Participant
June 28, 2018

I have the same issue with online vs printable use and use a document level javascript combined with a field level javascript.

Document level...

function LinesBlur(fieldName)
{
var f = this.getField(fieldName);

if(f.value != ""){
f.fillColor = color.white;
f.strokeColor = color.white;
}else
f.fillColor = color.transparent;
f.strokeColor = color.transparent;
}

Field level... (I use the On Blur trigger)

LinesBlur(event.target.name)

You might want to consider adding a button to clear the field and return the background to 'lines' as well.  This is a link to one of my forms:

https://www.courts.state.nh.us/forms/nhjb-2202-dfps.pdf

Feel free to use it as a starting point, happy to pass along the result of help I have received over the years from this forum:)

M

Princeplanet
PrinceplanetAuthorCorrect answer
Inspiring
June 28, 2018

Thank you, Thank you, Thank you!