Skip to main content
Known Participant
July 14, 2023
Question

2 different radio button groups to affect the same fields

  • July 14, 2023
  • 1 reply
  • 787 views

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

 

 

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.

This topic has been closed for replies.

1 reply

Known Participant
July 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?

 

Thom Parker
Community Expert
Community Expert
July 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 PDFScriptingUse the Acrobat JavaScript Reference early and often
Known Participant
July 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