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

2 different radio button groups to affect the same fields

Participant ,
Jul 14, 2023 Jul 14, 2023

Hello Community,
Im trying to update the code in a form I created a couple of years ago as I know it can be coded more efficiently.

I have 2 sets of radio button groups (Group402.contarcthire & Group404.servicecontract) both with yes/no answers, neither yes/no is set as default but both are required to have an input.

 

Group402.Contarct Hire "Yes"

Makes Group403 visible & required=true

Automatically makes Group404.servicecontract "Yes" selected which in-turn makes Group407 visible & required=true. If possible Group404.Servicecontract "No" should not be selectable or made hidden?

Group402.Contarct Hire "No"

Group403 is hidden and required=false

Group404 is visible & required=true

Group407 is hidden & required=false (however this will change to visible & required=true if Group404.service contract "Yes" is selected

Group404.Service Contract "Yes"

Makes Group407 visible & required=true (with Contract Hire selected as "No" as noted above)

Group404.Service Contract "No"

Makes Group407 hidden & required=false

 

Screenshot 2023-07-14 131522.jpg

 

I hope the above all make sense as currently I have multiple copies of the same fields being hidden or made visible depending on the buttons selected and its making the form very clunky to use.

TOPICS
How to , JavaScript , PDF forms
593
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
Participant ,
Jul 18, 2023 Jul 18, 2023

Hi Everyone,

Is anything like this possible or should i continue to duplicate fields and call them in independantly from the 2 groups of radio buttons?

 

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 18, 2023 Jul 18, 2023

Post the current code.  And provide details of the differences in field names between the different groups that are supposed to work the same way.  

 

If there is redundancy in a system, then it can be made more efficient through abstraction. So yes, you can probably do this more efficiently. 

 

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
Participant ,
Jul 20, 2023 Jul 20, 2023

Hello Thom,

I will get this to you, im just grouping all the fields that require it as originally I had coded each field individually, not previously being aware of the group naming function.  I have however attached my form so you can see the area in question currently before the grouping.  The areas in question are Fiannce and Service Contract.  I have a question regarding simplifying the code on the submit button but that can wait for another day

 

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 20, 2023 Jul 20, 2023
LATEST

This is a big form with a lot going on.  It probably has too many calculations, and I think there is a lot that could be done to make it more efficient.  However, I'm not going to analyse the form.  You'll need markup the things you want to ask about and provide simple to the point questions.   

 

 

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