• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Lines in text boxes

Community Beginner ,
Jun 11, 2016 Jun 11, 2016

Copy link to clipboard

Copied

I am redoing forms for a local police department. They need fillable text boxes that have horizontal lines the text follows. They want the option of printing the form with the blank lines when they cannot fill the form electronically.

I have added lines using commenting and "eyeballing" their position between the lines of text. Is there an easier way?

Thanks

Pat Freel

Madison, AL

TOPICS
Acrobat SDK and JavaScript , Windows

Views

515

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
Advocate ,
Jun 11, 2016 Jun 11, 2016

Copy link to clipboard

Copied

This is a situation which has been around for a long time.

One approach is to create those writing lines as part of the contents of the form (in other words, in the layout software). So, if the user prints the blank form, he has the writing lines.

Now, if the form is filled on screen, those writing lines are more an annoyance than useful. And they are not needed, because text in a field will always be well aligned.

With a little bit of JavaScript, we can have both options. In the Format event, you could add the following custom script:

if (event.value.toString().length > 0) {

event.target.fillColor = color.white ;

} else {

event.target.fillColor = color.transparent ;

}

If there is something in the field (the length of its value as string is greater than 0), the background of the field is white, and covers he writing lines. Otherwise, the background is transparent, and the lines are visible.

Hope this can help.

Votes

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
Community Beginner ,
Jun 12, 2016 Jun 12, 2016

Copy link to clipboard

Copied

I have no experience using javascript in a form.  Where do I insert the code for that text field?

Thanks

Pat

Votes

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
Community Expert ,
Jun 12, 2016 Jun 12, 2016

Copy link to clipboard

Copied

In Form Edit mode, right-click your field and select Properties. Switch to the Format tab and then select Custom and enter the code under the Custom Format Script option.

Votes

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
Community Beginner ,
Jun 12, 2016 Jun 12, 2016

Copy link to clipboard

Copied

I created a new text field and then applied the script. No lines appear.

Thanks

Pat

Votes

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
Advocate ,
Jun 12, 2016 Jun 12, 2016

Copy link to clipboard

Copied

Now add text to the field, move out of the field, get back in, delete the text, and move out again.

If everything was done correctly, you now should see lines which were originally covered by the field.

To confirm that, try with another field, and set the field's background to transparent as default.

Votes

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
Community Beginner ,
Jun 13, 2016 Jun 13, 2016

Copy link to clipboard

Copied

LATEST

I think I get it now. I create the text field OVER the existing lines………….

I’ll try it. Thanks

Pat

Votes

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