Need help with Complex Dynamic Attribute

I have got some fairly complex repeats and dynamic attributes. I know that setting up a dynamic attribute can be done like this

dmx-on:change="modal1.form2.input2_group['a2_id_' + var_id_number.value + '_0'].select(false)"

which will output as
modal1.form2.input2_group.a2_id_125_0.select(false)
and where var_id_number is a variable set-up on the page.

BUT, what if I want to put the input2_group as a dynamic as well? So I tried…

dmx-on:change="modal1.form2['Group_Paint_' + carparts_id]['a2_id_' + var_id_number.value + '_0'].select(false)"

but this doesn’t work.
I then put a full-stop between the middle two square brackets like

dmx-on:change="modal1.form2['Group_Paint_' + carparts_id].['a2_id_' + var_id_number.value + '_0'].select(false)"

but this doesn’t work.
I could create both dynamic parts as variables and put variables in like this…

dmx-on:change="modal1.form2.var_group_paint.value.var_a2_id.value.select(false)"

But this doesn’t work.

I am sure the syntax is simple but I am struggling to guess it.
Can somebody give advice please.

Community Page
Last updated: