PDF Editing Issues

Hide Ruled Lines When Text Is Entered in an Acrobat PDF Form

Rana GarciaRana Garcia Nov 19, 2026 868 views

Question details

Create a PDF form that shows ruled lines when a text field is empty and hides them when text is entered.

Hide Ruled Lines When Text Is Entered in an Acrobat PDF Form
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A form needs lines for handwritten answers on a blank printout and a clear background for digitally entered answers.
Observed behavior
The desired form shows lines through an empty field and covers them with a white field background after text is entered.
Before you start

Open the PDF in an Acrobat version that can edit form fields, and make sure the ruled lines are already part of the page. Test the finished form in a PDF viewer that supports Acrobat form JavaScript.

Solution 1Recommended

Use a Validation Script to Change the Text Field Background

Use this method to switch the field background between transparent and white when the user commits an entry.

The text field sits over the ruled lines. A transparent fill reveals the lines when the field is empty; a white fill covers them when the field contains text.

1
Open form editing

In Acrobat, open the PDF and select All tools > Prepare a form. Add a text field over the ruled lines, or select an existing field and resize it to cover them.

2
Set the initial appearance

Right-click the text field, select Properties, and open Appearance. Set the fill color to transparent and choose an appropriate text color. On the Options tab, enable Multi-line if the answer needs more than one line.

3
Add the validation script

In the field Properties dialog, open the Validate tab, select Run custom validation script, and click Edit. Enter: event.target.fillColor = event.value !== "" ? color.white : color.transparent;

4
Save and test

Close the dialogs, save the PDF, and exit form editing. Enter text and press Tab or click another field to commit it; the background should turn white. Clear the field and commit it again to reveal the lines.

Use a Validation Script to Change the Text Field Background
Viewer support matters: Validation scripts run when the field value is committed, not necessarily after each keystroke. Some browser PDF viewers and third-party apps do not support Acrobat JavaScript, so test the form in Acrobat or Acrobat Reader.
Edit PDFs with WPS Office

Cover Ruled Lines Manually in WPS PDF

For a one-time filled copy, use WPS PDF annotation tools to cover the lines with a white shape and add your answer. This is a manual workaround and does not create Acrobat's automatic field behavior.

  1. 1. Open the form: Open WPS Office, select Open, and choose the PDF form.
  2. 2. Cover the lines: In WPS PDF, open the annotation or Comment tools and draw a rectangle over the lines. Set its fill to opaque white and remove the border if those options are available.
  3. 3. Add your answer: Select the text box annotation tool and place a text box over the white rectangle. Enter and format your answer.
  4. 4. Save the filled copy: Use File > Save As to save the annotated PDF, then open the saved copy to check that the text and covered lines appear as intended.
Cover ruled lines and add a typed answer to a PDFReview and annotate PDFs in one office suiteOpen Microsoft Word DOCX, Excel XLSX, and PowerPoint PPTX filesUse a familiar interface for common document tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why do the lines still show after I type?

Press Tab or click outside the field to commit the value and trigger validation. Also check the field's Validate tab for the script and test in Acrobat or Acrobat Reader with JavaScript enabled.

Will the lines return if I delete the answer?

Yes. Clear the field and press Tab or click another field. The validation script sets the fill to transparent when the committed value is empty.

Can I use this for a multiline answer?

Yes. In Prepare a form, open the text field's Properties > Options and enable Multi-line. Make the field large enough to cover the ruled area.

Will the blank form print with the ruled lines?

The lines should print when they are part of the PDF page and the empty field has a transparent fill. Print a test page from your intended viewer to confirm.