Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Resting Radio Buttons when Radio Button Field is hidden

Avatar

Level 1

Hi,

I have a subform with 4 radio button options that's hidden. Based on answers earlier in the form, only certain radio buttons will appear. How do I reset the radio buttons when they're hidden without creating a "Reset" button?

For instance in question 1  if they check "yes" radio buttons A B C will show. IF they click radio button A then a specific set of questions will appear. But if they uncheck yes in question 1 - then the A B C radio buttons will disappear, but the special subforms for A are still visible. Is there a way when the radio buttons are hidden that they are basically rest - which would rest the rest my form?

I have the radio buttons set up so when A is NOT selected the subforms for that option are hidden. However, when the field with the radio buttons are hidden, A is still selected, just not visible.

Hopefully this is as clear as mud.

1 Reply

Avatar

Level 10

Hi,

This depends on how you have done your show/hide code.  If you were to have a subform that contained a radio button list called YesNo, one called ABC and a subform call aContent, then in the subform calculate event you could have code like;

if (YesNo.rawValue == 1) {

  ABC.presence = "visible";

} else {

  ABC.presence = "hidden";

  xfa.host.resetData(ABC.somExpression);

}

if (ABC.rawValue == 1) {

  aContent.presence = "visible";

} else {

  aContent.presence = "hidden";

}

The thing to note here is that when the ABC radio button list is hidden the value is also reset with the call to xfa.host.resetData()

Bruce