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

SOLVED

Reset to original document

Avatar

Level 5

I have a form that have several buttons. It has buttons to add and remove a record.  It also has a reset button which clears all information in each record created.  My form starts off with one blank record and I can add as many records as needed.  The problem is that if I create 30 records, I will need to click the "remove record" button 29 times in order for the form to get back to where it started off.  Is there a way to remove all records created at once so that I can start off with one record after I reset the records?  This form was created in livecycle.

1 Accepted Solution

Avatar

Correct answer by
Level 10

try

if(xfa.host.messageBox("Are you sure you want to erase all records and entries?", "Reset the form", 2,2) == 4){

    xfa.host.messageBox("All entries have been removed");

    xfa.resolveNode("form1.obtainedsubform.cardssubform.CARDS._Table1").setInstances(1);

    xfa.host.resetData();

}

else {

    xfa.host.messageBox("No entries have been removed");

}

View solution in original post

0 Replies

Avatar

Level 5

I found a thread and entered this script, however, when I click no, it still resets the form.

if(xfa.host.messageBox("Are you sure you want to erase all records and entries?", "Reset the form", 2,2) == 4){

xfa.host.messageBox("All entries have been removed");

}

else{

xfa.host.messageBox("No entries have been removed");

}

Avatar

Level 10

That code looks ok to me, where in that have you put your actual reset code, maybe if you could cut-and-paste the whole click event code from your form.

Avatar

Level 5

form1.#pageSet[0].Page1.HEADER.ResetButton1::click - (JavaScript, client)

xfa.resolveNode("form1.obtainedsubform.cardssubform.CARDS._Table1").setInstances(1);

xfa.host.resetData();

if(xfa.host.messageBox("Are you sure you want to erase all records and entries?", "Reset the form", 2,2) == 4){

xfa.host.messageBox("All entries have been removed");

}

else{

xfa.host.messageBox("No entries have been removed");

}

Avatar

Correct answer by
Level 10

try

if(xfa.host.messageBox("Are you sure you want to erase all records and entries?", "Reset the form", 2,2) == 4){

    xfa.host.messageBox("All entries have been removed");

    xfa.resolveNode("form1.obtainedsubform.cardssubform.CARDS._Table1").setInstances(1);

    xfa.host.resetData();

}

else {

    xfa.host.messageBox("No entries have been removed");

}

Avatar

Level 5

That works!!  Thank you so much for your patience and helping me.