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

hide fields with checkbox’s

Community Beginner ,
Dec 05, 2021 Dec 05, 2021

I have radio buttons check box's  Choice1 and Choice2 

 

When the user checks Choice 1 I need for field Destination to hide 

 

When user checks Choice 2 I need for PORT and FOREIGN to hide


I also need to use the reset button to return them to original document. 

TOPICS
Acrobat SDK and JavaScript , Windows
1.4K
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 06, 2021 Dec 06, 2021

Are they radio-buttons of check-boxes? Do they have the same name but unique export values, or do they have unique names? If the latter, what's their export values, and what should happen if both are ticked?

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 06, 2021 Dec 06, 2021

The radio buttons are Choice1 and Choice 2 =both Group1.

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 06, 2021 Dec 06, 2021

one or the other has to be selected. They both cannot be selected at the same 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 ,
Dec 06, 2021 Dec 06, 2021

OK. And are the other fields text fields?

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 06, 2021 Dec 06, 2021

Yes text then a fillin field. 

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 06, 2021 Dec 06, 2021

OK, then as the custom calculation script of the first field use this:

event.target.display = (this.getField("Group1").valueAsString=="Choice1") ? display.visible : display.hidden;

 

And under the other two fields use this:

event.target.display = (this.getField("Group1").valueAsString=="Choice2") ? display.hidden : display.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
Community Beginner ,
Dec 14, 2021 Dec 14, 2021

Ok so I gave this a try and it seems to be permanently hiding the destination field. 

also I want the entire field to disappear like the word destination and the fill-in text box to disappear. Is that possible? 

 

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

Please share your file for further help.

If you want to hide the text next to the field you will need to place a (read-only) field on top of it, with a white fill color, and show it when you want the text to be hidden, and vice versa.

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

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
Community Expert ,
Dec 20, 2021 Dec 20, 2021

You should read this article:

https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm?sd=40

 

 

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 20, 2021 Dec 20, 2021
LATEST

I am going to take a look at this. 

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