Skip to main content
Participating Frequently
April 29, 2019
Answered

reset and remerge form so it returns to original state

  • April 29, 2019
  • 1 reply
  • 1043 views

I'm a novice at this so I'd appreciate any help. I've done a lot of searching in forums and can't find a full answer to my problem. I have a 12 page form, mostly text fields, but also radio buttons and check boxes. I have many check boxes/radio buttons that when selected reveal a hidden text field. I want to add an option to clear the form, but when I set up a reset button using the "Reset a form" default action, it not only clears the form, but clears out the hidden form field properties and they all are visible again. I want to create a button using script to clear the form while keeping all form fields in their original state. In my searching I found this script:

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();

}

I am assuming something like this will work and I know I will need to add more to it,  I am just not well versed enough to know how to finish it so it works with my form. Do I simply add page numbers in to the reset and remerge sections, or is it more complicated like adding each field name, group name etc., and could someone show me an example of how it is written out?

This topic has been closed for replies.
Correct answer try67

Then these two lines won't work:

xfa.host.resetData();

xfa.form.remerge();

Replace them with this:

this.resetForm();

It should not cause the visibility of your fields to change, just their values.

1 reply

try67
Community Expert
Community Expert
April 29, 2019

Is this a LiveCycle Designer form?

COmediaAuthor
Participating Frequently
April 29, 2019

No, it was made in Acrobat Pro

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
April 29, 2019

Then these two lines won't work:

xfa.host.resetData();

xfa.form.remerge();

Replace them with this:

this.resetForm();

It should not cause the visibility of your fields to change, just their values.