Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Group of radio button answers selects an outcome

Avatar

Level 3

Hi, I have a form with two sets of 'yes/no' questions. Depending on whether there is a 'yes' or 'no' selected within the two sections an outcome (checkbox) is selected. First section is 'was this a predictable event', second is 'was this a preventable event'. There are 7 questions in each section. If yes to any in the first section it is 'predictable' and if yes to any in the second section it is 'preventable'.

Outcomes are 'Predictable & preventable', 'Predictable & not preventable', 'Not predictable & not preventable', and 'Not predictable & preventable'.

I know there are long ways around this, but is there a simpler script for automatically ticking the outcome based on the responses.

Thanks for any help!!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

One option would be to bind a 1/0 value to all of the radio buttons: Yes = 1 and No = 0 (go to the Object > Bind panel).

This way you can have an if/else statement in the calculate event of the checkbox:

If (SUM of predictable group of radio buttons >= 1 AND SUM of preventable group >=1) then set the value of the checkbox to on.

This way if any of the radio buttons in both groups is Yes, the checkbox will be set to ticked.

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

One option would be to bind a 1/0 value to all of the radio buttons: Yes = 1 and No = 0 (go to the Object > Bind panel).

This way you can have an if/else statement in the calculate event of the checkbox:

If (SUM of predictable group of radio buttons >= 1 AND SUM of preventable group >=1) then set the value of the checkbox to on.

This way if any of the radio buttons in both groups is Yes, the checkbox will be set to ticked.

Hope that helps,

Niall

Avatar

Level 3

Thanks Niall - after a bit of fiddling (I don't have the greatest coding knowledge) I got it to work based on your advice. Cheers!