Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Reset data in subform(s) when drop-down changes

Avatar

Level 1

Hello,

I have searched the already answered questions and have not seen one that would help me.  If this has already been answered, please direct me to the correct post.

Short form:  How can I make a drop-down choice reset an entire subform if it is changed.

Long form:

My form has a basic first two pages, followed by a department-dependent (via drop-down) set of subforms, with their own sub-sub-sub forms, dependent on check boxes.

I want to make it so if the department choice on the drop-down changes, it will reset all of the fields within the department-dependent subform.  Even though the fields will not be visible anymore once the selection is changed, they want the changes to be reset.

I am mostly familiar with using the action builder, and doing basic formulas using FormCalc, so, please be explicit with any answers that involve scripting.

Thank you for your time,

Nichole Wilhelm

1 Reply

Avatar

Community Advisor

Write the below script to reset the subform data.

 

xfa.host.resetData("somExpression of your subform will come here");

 

eg.:  xfa.host.resetData("xfa.form.form1.testVk");

 

testVk is my subform name here and form1 is my page name