How to create multi-line text box on top of printed lines for writing?

Explorer ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

When I create a form, I have a large area of multi-line text for people to fill the form on their computer. But when they print the form, I want to have lines appear for them to write on. But if someone types into the form with their computer, the lines of text do not correspond with the lines that I have drawn for writing into. Is there a way to have the lines not appear if the person fills the form with their computer, but print if they don't fill in the text box from their computer?

TOPICS
How to , PDF forms , Print and prepress

Views

150

Likes

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

correct answers 1 Correct answer

Explorer , Apr 15, 2022 Apr 15, 2022

Ok, here's my final solution! I created two actions. OnFocus I have this script:

this.getField(event.target.name).fillColor = color.white;

Which hides the lines as soon as a cursor comes into the field.

 

Then I examine the contents when exiting and set the background with an OnBlur action:

var fld = this.getField(event.target.name);
fld.fillColor = fld.value = "" ? ["T"] : color.white;

If nothing was entered, the text lines show, otherwise the box has a white background.

THANKS for all your help, Try6

...

Likes

Translate

Translate
Adobe Community Professional ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

You have to manually (and carefully) adjust the size of the font and location of the field for them to match. It's not an easy task. But there's no need for the fields if the form is filled digitally, so you can set the field as having a white fill color and as visible on the screen, but change it to be hidden when printed, if it's empty.

This requires using a script, though.

Likes

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
Explorer ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

Thanks for the quick answer! I suspected it wasn't going to be easy. I found a scripting tutorial at https://www.youtube.com/watch?v=wySx6rhK-E4 so it's back to school for me! (I'll be back!)

Likes

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
Explorer ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

Ok, I'm back (quick learner). Here's the script I came up with:

var fld = this.getField("mission");
fld.fillColor = fld.value > "" ? ["T"] : color.white;

This makes the background color white (blocking the background lines) if anything is entered in the field. BUT, it happens when I exit the field. As I type characters, I see them overlaying the lines (inaccurately).

Is there any way to have the script run more interactively as soon as the first character is typed?

Likes

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
Adobe Community Professional ,
Apr 15, 2022 Apr 15, 2022

Copy link to clipboard

Copied

This is incorrect:

fld.value > ""

 

Change it to:

fld.value != ""

Likes

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
Adobe Community Professional ,
Apr 15, 2022 Apr 15, 2022

Copy link to clipboard

Copied

> Is there any way to have the script run more interactively as soon as the first character is typed?

You can use a keystroke event, but the field's appearance will not update until you exit it.

 

Likes

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
Explorer ,
Apr 15, 2022 Apr 15, 2022

Copy link to clipboard

Copied

Ok, here's my final solution! I created two actions. OnFocus I have this script:

this.getField(event.target.name).fillColor = color.white;

Which hides the lines as soon as a cursor comes into the field.

 

Then I examine the contents when exiting and set the background with an OnBlur action:

var fld = this.getField(event.target.name);
fld.fillColor = fld.value = "" ? ["T"] : color.white;

If nothing was entered, the text lines show, otherwise the box has a white background.

THANKS for all your help, Try67. I'm learning a lot!

Likes

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
Adobe Community Professional ,
Apr 15, 2022 Apr 15, 2022

Copy link to clipboard

Copied

You have an error in your code that will cause the field to reset.

Change this:

fld.value = ""

To:

fld.value == ""

Likes

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
Adobe Community Professional ,
Apr 15, 2022 Apr 15, 2022

Copy link to clipboard

Copied

Also, this line is unnecessarily complicated:

var fld = this.getField(event.target.name);

You can replace it with:

var fld = event.target;

Likes

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
Explorer ,
Apr 15, 2022 Apr 15, 2022

Copy link to clipboard

Copied

LATEST

Thanks for both of the headsup, Try67! I made the changes you suggested, but the single = sign does appear to work ok???

Likes

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