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

A script to hide ruled lines

Explorer ,
Jul 21, 2022 Jul 21, 2022

I want to make a single PDF that can either be printed out OR filled out as a form online.

when it is printed i want ruled lines for the end user to write on and when it is being filled out digitally i do not want the ruled lines.

 

i found a script in an old forum that should do exactly what i want but either i am using it wrong or it no longer works (old forum post) 

 

here is the script that i found and tried to use...

 

This has been a long time issue with many of the forms I have done for my clients.In almost all cases, it boiled down to the question why there were those writing lines, and the conclusion was that the lines were here to help the user write in their text.
Now, if you fill out the form on screen, you don't need those guide lines at all, and the text is way more readable as well.
So, we came to the conclusion that when the form is filled out on screen, we don't need those lines, and we treat each of these fields with the following Format script:

if (event.value.toString().length > 0) {
event.target.fillColor = color.white ;
} else {
event.target.fillColor = color.transparent ;
}

So, if the field is empty, the lines will show through, and the form can be printed and filled out manually. If the field is not empty, the lines will be covered up, and we don't have to worry about them anymore.


 

can anybody let me know if the script no longer works or if i need a few tips on how to use it

TOPICS
How to , JavaScript , PDF forms
591
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 ,
Jul 21, 2022 Jul 21, 2022

The script will work.

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 ,
Jul 21, 2022 Jul 21, 2022

It's meant to be used in a text field as validation script, you draw lines and then put text field over the lines, if you write something text field will have white background and lines will be invisible, if field is empty background is transparent and lines are visible.

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
New Here ,
Feb 15, 2023 Feb 15, 2023
LATEST

Did you find a solution? I am in the same situation and found the same script. I can't get it to work and it is driving me bananas!!!

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