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

Text Box with Lines

Community Beginner ,
Dec 28, 2021 Dec 28, 2021

How can I create a fillable text box with lines?

TOPICS
PDF forms
5.7K
Translate
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 ,
Dec 28, 2021 Dec 28, 2021

Explain what you mean by "create a fillable text box with lines"

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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 ,
Dec 28, 2021 Dec 28, 2021

I want to create a text box that has lines in it example:

____________________________________________

____________________________________________

____________________________________________

So that when you type it the words are above the line like on a piece of paper.

Translate
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 ,
Dec 28, 2021 Dec 28, 2021

The Appearance tab on the Form Field Properties window provides an option for an "Underline" on the field. I do not find this option very useful. Espcially since its only good for single line fields. 

It is much better to add the lines to the PDF Page, then place the form fields over the lines. 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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 ,
Dec 28, 2021 Dec 28, 2021

Thank you, I tried something like that but as I type and move to the next line the spacing changes.  By the time i get to the 4th or 5th sentences the lines are in the middle of my sentences.

 

Heres and example of what happens:

Translate
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 ,
Dec 28, 2021 Dec 28, 2021

Yes, you have to set the font size to exacty match the spacing of the lines. It's tricky but doable.  You can use decimal numbers for the font size. For example, you can set a font size of 10.86 points. 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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 ,
Dec 29, 2021 Dec 29, 2021

The underlines date from paper forms, you have to change the paradigm.

Users do not need those lines because it is not possible to write crookedly in a digital form, so just use a color (white) to hide lines that are on the layout.

🙂


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 ,
Dec 29, 2021 Dec 29, 2021

Hi JR,

I like your way of thinking!! Unfortunately I run into this all the time. The paper mindset will be with us for a while. Customers insist on having lines for multiline inputs. We need to change this to using a box for multiline.   

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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 ,
Dec 31, 2021 Dec 31, 2021

Hi Thom

 

I also have customers like yours.

In this case I leave the background transparent so that the lines are displayed, I place a script in an onFocus Action which changes the background in white as soon as the user starts the input, and a script in an onBlur Action which checks if the field as been filled. If so, it remains white, if not it becomes transparent again.

😉


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 ,
Dec 31, 2021 Dec 31, 2021

Nice Solution!  I will keep this in mind. Thanks JR 🙂

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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 ,
May 20, 2024 May 20, 2024

Would you share your javascript with me please?

Translate
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 ,
May 22, 2024 May 22, 2024

Ex3535 :

// ON FOCUS
if (event.target.value == event.target.defaultValue) {
	event.target.value = "";
	event.target.textColor = color.black;;
}


// ON BLUR
if (event.target.value == "") {
	event.target.value = event.target.defaultValue;
	event.target.textColor = color.ltGray;
}

 

 


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 ,
May 23, 2024 May 23, 2024

I am truly grateful for this! Trying it now. THANK YOU ♥

Translate
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 ,
May 23, 2024 May 23, 2024

I tried the javascript you gave me above. Sorry I am new to java - what values, if any, do I need to change in order to apply this to my text box?  The background is not filling with white when I type in it. It currently stays transparent.

Am I doing this right?  Thanks so much for your time.

Translate
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 ,
May 23, 2024 May 23, 2024

You must change the fillColor, not the textColor.

Translate
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 ,
May 23, 2024 May 23, 2024

I didn't change anything at all. So I'm not sure where to insert the value. I placed the action just as you gave it to me, because I thought it was complete.  I'm sorry for any miscommunication.
I've been playing around with various insertion points and am having a hard time.  I want the text box to be white if they type in it, and transparenet if they just want to print and fill in manually.  Am I asking the wrong questions? I was pretty good at HTML at one time, but it's been a while and java is something I've never attempted to learn well. 

Any advice you could share would be humbly appreciated.

Translate
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 ,
May 23, 2024 May 23, 2024

Oh, sorry I thought I was replying to @JR Boulay 

Translate
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 ,
May 23, 2024 May 23, 2024

You can use this as 'On Blur' action (remove other scripts):

event.target.fillColor = (event.target.value == "") ? color.transparent : color.white;

 

If the field is empty, fill color will be transparent and if there is value in the field, fill color will be white.

Translate
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 ,
May 24, 2024 May 24, 2024
LATEST

@Nesa Nurani  THANK YOU! That worked perfectly. 

You saved me SO much work... Blessings to you.

Translate
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