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

hide and show form field in page 2 based on a checked box in page 1

New Here ,
Apr 10, 2025 Apr 10, 2025

I am trying to have a form field show/hide on 'page 2' when a check box in 'page 1' is checked. Below will only work if on the same page - I have tested with multiple other fields 

 

if (event.target.value === "Off")  {

     this.getField("LOC ZIP").display = display.hidden;

} else {

     this.getField("LOC ZIP").display = display.visible;

}

 

HELP PLEASE 

TOPICS
JavaScript , PDF forms
267
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 ,
Apr 10, 2025 Apr 10, 2025

That should work no matter on which page it is.

Where did you place the script?

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 ,
Apr 10, 2025 Apr 10, 2025

Is this a mouse up action in the check box?  Does the field name in your script match the actual field name, exactly, including spaces and case sensitivity?

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 ,
Apr 10, 2025 Apr 10, 2025

Yes & Yes 

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 ,
Apr 10, 2025 Apr 10, 2025

I used the same templated script for  multiple fields and the trend i am finding is that it is not working for any field that is not on the page of the checkbox with the script 

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 ,
Apr 10, 2025 Apr 10, 2025

Can you share your file with us?

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 ,
Apr 10, 2025 Apr 10, 2025

Unfortunately I cannot as the file itself is propreitary 

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 ,
Apr 10, 2025 Apr 10, 2025

You can make a blank 2-page PDF and copy all those fields to the new PDF - or use "Replace page" to replace all the page contenten with blanks.

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 ,
Apr 10, 2025 Apr 10, 2025

Well now I have a NEW problem - i decided to delete ALL JavaScript from the pdf for now... however some of my fields are hiding even when the script is gone, HELP 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 ,
Apr 10, 2025 Apr 10, 2025

You should be able to see all fields when in edit mode (Prepare Form) in Acrobat Pro.

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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 ,
Apr 10, 2025 Apr 10, 2025

So, create a sample file without the proprietary info. 

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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 ,
Apr 10, 2025 Apr 10, 2025

The code is working perfectly for me. 

Triple-check your field name and make sure you have the end brace in your code.

 

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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 ,
Apr 10, 2025 Apr 10, 2025

Works fine for me... See attached.

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 ,
Apr 10, 2025 Apr 10, 2025

i used VSC  and the code WORKed just fine thats not the problem I was running into but now I just need to remove it fully. Does Adobe have a bug that it holds desperately onto a javascript thats since been removed?

 

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 ,
Apr 10, 2025 Apr 10, 2025

You were already asked "where did you put the script" 6 hours ago from this post. 

I put the script as an action on the checkbox. When I deleted the action, the script was deleted too. 

However, you can open the JavaScript set of tools and check All JavaScripts. 

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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 ,
Apr 10, 2025 Apr 10, 2025

Thats where I put them and thats where I removed them .. they are still activated outside of preparing the form 

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 ,
Apr 10, 2025 Apr 10, 2025
LATEST
quote

Thats where I put them and thats where I removed them .. they are still activated outside of preparing the form 


By @MegDough926

Sorry--you have to be doing something wrong. Sanitize the file and upload your coded version.

 

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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