Expand my Community achievements bar.

Reset values of the fields in multiple occurence of forms

Avatar

Level 2

I am working on livecycle version 8.2.

Attached is the form for reference.

I would like to know , how to reset field values if we have multiple instance of the subform.

I tried doing that but whenever I edit the code it flags run time error and my form becomes zero byte and I have to start again from scratch.

The problem is  that when I repeat my form fragment, fields like service window class name, form name, form code, LC URL, and all other fields of that section get reset only for first occurrence not on every instance.

To get the "resetData" code working on every instance what should I do..?

I am relatively new to the technology so I would really appreciate if you can guide me.

My form has dependency on fields like form type(Main Form) and form already exists(Yes/No) fields.

If form is a main form few subforms appear and if it main form all the forms appear.

So to have the combination of form exists-yes , form type= main form

Form Exists     :     Yes              Yes               No                        No

Form Type     :     Main form           Subform           Main form              Sub form

These vertical combinations have various fields dependency.

And I am not able to reset the data in other occurrence of form.

I can reset data only on first occurrence.

Please suggest.

2 Replies

Avatar

Former Community Member

use code like this to make a collection of all instances of the repeating subform, then step through them:

var Collection = repeatingItem.all;

var curItem;

for (var i=0; i < Collection.length; i++){

     curItem = Collection.item(i);

     //Do code here on curItem, and it will be repeated for each instance of that item.//

}

Avatar

Level 2

Hi,

Thanks for the reply.

Can you please elaborate more... I am still not clear with the explanation.

As I told I have dependencies on my drop down, where exactly these variables should be declared and if I have the whole form repeating with subforms embedded in it which is also repeating..

Where exactly this piece of code for declaring collections should be mentioned.

If I select drop down value as "Main form" and form already exists as "No"

Service window and payment component window appears ...

These windows are my sub forms which contains additional fields which are repeating in nature.

And if user selects drop down value as "Sub form" and form already exists as "Yes"

These subforms should be hidden and the fields should get reset.

Here I wanted to implement a code which can reset all the occurance...

So please guide.

Thanks in advance.

Thanks and Regards,

-Soni Gupta