• 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 get 1 text field to control the visibility of another

New Here ,
Dec 15, 2024 Dec 15, 2024

Copy link to clipboard

Copied

Hello,


the basics of what I am trying to to is this :

I have a text field called Panel length 1 - i want it so that when a number that is 45 or less is entered into that text field , a second text field called 20ga 1 will become visible - if the number 46 or greater is entered, or there is no number entered at all the text field called Panel length 1 then the text field called 20ga 1 will stay hidden. 

does this make sense or even possible?

thanks in advance for any guidance that can be provided. 

TOPICS
Create PDFs , Edit and convert PDFs , General troubleshooting , JavaScript , PDF forms

Views

94

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
1 ACCEPTED SOLUTION
Community Expert ,
Dec 15, 2024 Dec 15, 2024

Copy link to clipboard

Copied

Yes, this is possible and not very difficult. 

Use a validation script on the "Pandl Length 1" field.  

this.getField("20ga 1").display = ((event.value != "") && !isNaN(event.value) && (event.value <= 45))?display.visible:display.hidden;

 

this code tests the entered value for a non-empty entry, that it is a number, and it is less than or equal to 45. 

 

You can read more about hiding and showing fields here:

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

View solution in original post

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 ,
Dec 15, 2024 Dec 15, 2024

Copy link to clipboard

Copied

Yes, this is possible and not very difficult. 

Use a validation script on the "Pandl Length 1" field.  

this.getField("20ga 1").display = ((event.value != "") && !isNaN(event.value) && (event.value <= 45))?display.visible:display.hidden;

 

this code tests the entered value for a non-empty entry, that it is a number, and it is less than or equal to 45. 

 

You can read more about hiding and showing fields here:

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
New Here ,
Dec 15, 2024 Dec 15, 2024

Copy link to clipboard

Copied

LATEST

Thanks so very much!!! This worked beautifully 

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