cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Items of subform

Former Member
0 Kudos

Hi Community,

Is it possible to delete or set the attributes of a subform back (initial)?

But not for example with data1.rawValue = null;.

Maybe with a simple method?

E.g. you press on a button and the whole entered data of a subform will delete.

Thanks

Chris

Accepted Solutions (1)

Accepted Solutions (1)

OttoGold
Active Contributor
0 Kudos

There is a simple way hot to loop at the list of all "children" (children of the root, the root is the subform). In such loop you can copy the default values from backend, setup the values with code or remove the values completely (and use default values staticaly defined at design time maybe?).

Cheers Otto

Former Member
0 Kudos

Thanks Otto,

Could you give me a codeexample? How could I loop above my subform?

Greets,

Chris

Former Member
0 Kudos

Hi,

You can also use the below method.


	xfa.host.resetData(<subformname>);
        Example below:
	xfa.host.resetData("data.sf10.sf15");

Note: this is in Java script, check for such in ADLC help for formcalc if required.

if you have an heirarchy of subforms with in that subform you specifiecd in that method, it will flush data for all the child nodes with in it.

On button click event call this method for that particular subform and you are done.

Have a Try and let me know if you need any help.

Cheers,

Sai

Former Member
0 Kudos

Hi Sai

Thanks! Simply and efficient

Otto: Nevertheless could you give me an example to loop above a subform. It will be interesting.

Cheers,

Chris

Former Member
0 Kudos

Hi Chris,

You can loop subforms and tables in an adobe form by using the function resolveNodes().

var sub1 = xfa.resolveNodes("sfMain[*].sf1[*]");
var sub1_len = sub1.length;
for (var i=0; i<sub1_len; i++)
{
   var val = sub1.item(i).rawValue;
}

Similarly for table,

var tab1 = xfa.resolveNodes("sfMain.sf1[*].table1[*]");

Hope this will give you an idea.

Thanks & Regards,

Sanoosh

Former Member
0 Kudos

Thanks Janoosh,

I wanna check if somebody has entered something in one of my subform.

To check this I have to go through all my items in my subform with this loop. Do I?

Is there a easier way to do that?

Cheers.

Chris

Former Member
0 Kudos

Hi Chris,

I saw some code once in one of the Adobe forms.

That will basically do tree traversing, somebody wanted to validate field mandatory on the form then the reply was this traversing approach.

I didn't have the code right now, if you have no other approach then let me know i would try to find it once again.

Cheers,

Sai

Answers (0)