Expand my Community achievements bar.

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

delete instance subform with radioButton

Avatar

Level 4

Hello I have a problem, an object radio button (yes or no)
I have to delete instances if they are not valued

For example, if I believe 5 instances without exploiting any field, when I select NO I delete only those instances not valued




I put an example to better understand

how can I do??

5 Replies

Avatar

Former Community Member

Please clarify.

1) if the radio button is set to 'No', when you click the 'Delete' button the row instance is not deleted, or

2) if the radio button is set to 'No' and the drop-down selection is null, when you click the 'Delete' button the row instance is not deleted, or

3) another variation

Steve

Avatar

Level 4

When I read this and looked at the form earlier, I was thinking:

top yes/no radio buttons:


     if no: go through every sub2 subform and determine if the DDL is null, and if it is, delete the instance of the subform, while preserving those without data.

Avatar

Level 4

hello, do I create 5 instances an example, if you later select no (RadioButton)
I have to remove the 5 instances that I created but the first remains the default

Avatar

Level 4

in the no's click event:

for(var i=1; i<_sub2.count; i++){ //i starts at 1 to leave the default

     _sub2.removeInstance(i);

}

//then set sub2[0]'s aa/bb and DDL rawValue to null's

that is the basic structure that you will want.

Avatar

Level 4

Hello I tried the code will not work properly if the Subform Insert 5 instances are not eliminated completely