Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Resetting a dynamic form

Avatar

Level 3

How do you send a form back to its original state (the state in which it opens)? My form has subforms which are made visible or hidden based on user selection. The canned reset button just resets the input data but does not hide/show fields that are visible/invisible due to user interaction.

I don't know the command for re-initializing the form and a quick search turned up nothing.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Try a button with xfa.host.resetData(); and xfa.form.remerge();

I think that gets it most of the time.

I'll usually put it with a popup warning:

var nButton = app.alert({

cMsg: "Warning: You are about to reset all data in the form. \n\nDo you want to continue?",

cTitle: "Reset Form Data",

nIcon: 1, nType: 2

});

 

if (nButton == 4){

     xfa.host.resetData();

     xfa.form.remerge();

}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Try a button with xfa.host.resetData(); and xfa.form.remerge();

I think that gets it most of the time.

I'll usually put it with a popup warning:

var nButton = app.alert({

cMsg: "Warning: You are about to reset all data in the form. \n\nDo you want to continue?",

cTitle: "Reset Form Data",

nIcon: 1, nType: 2

});

 

if (nButton == 4){

     xfa.host.resetData();

     xfa.form.remerge();

}

Avatar

Level 3

Hi Jono,

Thanks! That works beautifully.

Nadeem