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

How to turn a form field visible depending on the value of another form field

New Here ,
Mar 20, 2021 Mar 20, 2021

Copy link to clipboard

Copied

I have form fields named DAY. And I have other form fields named JUSTIFICATION. But I need the fields JUSTIFICATION to appear only when something is written on the fields DAY, so that when nothing is written on the fields DAY, the fields JUSTIFICATION do not apper and do not be printed. I'd be really really thankful if someone could help me ith this.

TOPICS
How to , JavaScript , PDF forms

Views

441

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

Community Expert , Mar 20, 2021 Mar 20, 2021

You can accomplish this with JavaScript.

 

You may use, for example, a custom calculation script in the DAY field object like this:

 

if (event.value =="") {

this.getField("JUSTIFICATION").display = display.hidden;

 

} else {

 

this.getField("JUSTIFICATION").display = display.visible;

 

}

 

I am typing from my mobile device, so I haven't tested the example script above.

 

See if it works for you.

Votes

Translate

Translate
Community Expert ,
Mar 20, 2021 Mar 20, 2021

Copy link to clipboard

Copied

You can accomplish this with JavaScript.

 

You may use, for example, a custom calculation script in the DAY field object like this:

 

if (event.value =="") {

this.getField("JUSTIFICATION").display = display.hidden;

 

} else {

 

this.getField("JUSTIFICATION").display = display.visible;

 

}

 

I am typing from my mobile device, so I haven't tested the example script above.

 

See if it works for you.

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
New Here ,
Mar 20, 2021 Mar 20, 2021

Copy link to clipboard

Copied

It worked perfectly, @ls_rbls, I'm so impressed... I know too little about JavaScript, and your help encouraged me to study it. Really grateful. You're amazing!

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 ,
Mar 20, 2021 Mar 20, 2021

Copy link to clipboard

Copied

You're welcome.

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 ,
Mar 21, 2021 Mar 21, 2021

Copy link to clipboard

Copied

LATEST

For more information on hiding and showing form fields, see this article:

https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm

 

 

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

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