Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.