Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Reset all fields in a repeating subform and restore instance count back to 1


Level 6

I've played around with a few different scenarios and able to achieve parts of the solution, but not there fully.

Whenever I"xfa.form.form1..."); only resets the fields in the 1st instance of the repeating subform. So if I have 3 instances, it only resets instance 1.

Currently, the subform is set to an initial count of 1, and additional instances are added via an "Add" button.

Thus, I'm looking for a solution that will not only reset all content within a "specific" subform (not entire form), AND restore the instance count back to 1.

Thank you in advance!!!

0 Replies


Level 10

Here I made a script object that works perfectly for reseting form... the only thing is that objects that were hidden initially in the form will not return hidden...

The method getExpressions in my script object myForm is to remove all instances of ROWS, all values from fields that are children of the subform specified

You can send the subform that you want it to be reset and also you can send names of objects that should not be reset inside the subform...

If you have any request, or question about it, you're free to ask!


Level 10

Oh, too have this method work, you would have to change your Subform instances to Rows instead.... if you keep subforms you will have to reset the instances by yourself


Level 6

Thanks Robert - I reviewed your file. Much appreciated.

Is there an easier approach? Seems like a lot of complex scripting for what I'm simply looking to do.

I just want to reset a specific subform's data instead of clearing the entire form. I can handle the part of resetting the instance count back to 1.


Level 10

well, actually if you want to reset specific fields in the form, you have to write all the som expressions of the objects you want to reset in the form into the method resetData();

the method I gave you is made to acquire all those somExpressions and reset all fields you want, all you need to do is remove the exception fields in the tabExceptions if you have no field in the form or subform you don't want to reset...

and just send the subform as parameter in the method and it will return all fields you want to reset...

that's what you want to do, and you have it all done, all you need to do is send the subform object as parameter...

otherwise you can write your own script to go reset each field one by one


Level 6

Here's a link to a basic file:

I know this is incorrect, but I was hoping I could use something"xfa.form.form1.Page1.Row[*]"); reset a specific/entire subform group that has multiple instances. However, the script ONLY clears the first instance.  WHat I think needs to happen is there needs to a script that loops through the named subform to gather all instances then somehow pass the count as a parameter to the resetData script.


Level 6

I played around with this a little further and found this simple, modified, approach works:

*Partial credit to Niall Donovan for use of "while" script in a different post

//Remove instances of subform until only 1 remains

while (Page1._Row.count > 1)




//Reset subform"xfa.form.form1.Page1.Row");


Level 2

Brilliant! Worked perfectly. Much obliged.