Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Remove all instances of a subform by a radio button option

Avatar

Level 4

I have a radio button with Yes/No options.  If the user selects 'Yes', a group of questions and a button are made visible.  If the user wants to add an additional group of questions they are to click on the button that was just made visible.  The additional group of questions are in a subform that will repeat if the user clicks on the button. If the user changes their mind from 'Yes' to 'No', I need to have the subforms that were added removed. How can all instances of repeating subform be removed by selecting the 'No' option?

Yes Radio Button script:

if (this.rawValue == 1) {

   subform.presence = “visible”;

}

Button Script:

  _subform2.addInstance(1);

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can control the number of instances with the setInstances() method.


  // Remove all instances of subform2
_subform2.setInstances(0);


View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

You can control the number of instances with the setInstances() method.


  // Remove all instances of subform2
_subform2.setInstances(0);


Avatar

Level 4

Perfect.  Thanks so much!!