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 just the current table instance

Avatar

Level 5

Good day,

I asked a question years ago about resetting just the current table instance and I received a reply from Radzar which worked.  Now, it's not working and I can't seem to understand why.  Below was the correct answer to my question.  I recently created another form and used the exact same script, now when I click the button it first clears the information in the first (2) rows of my table.  When I click it again, it clears the information in the other rows.  Any help is appreciated.

 

form1.howobtainedsubform.cardssubform.CARDS.Table1.Row11.adddeletesubform.erase::click - (JavaScript, client)
if (xfa.host.messageBox("Are you sure you want to erase all entries?", "Reset the form", 2,2) === 4){
xfa.host.messageBox("All entries have been removed");
xfa.host.resetData(CARDS.resolveNode("Table1[" + this.parent.parent.parent.index + "]").somExpression);
}
else {
xfa.host.messageBox("No entries have been removed");
}

2 Accepted Solutions

Avatar

Correct answer by
Level 5

Yes, SOM expression could be the issue. If you can share the form I can check. 
thanks

View solution in original post

Avatar

Correct answer by
Level 5
7 Replies

Avatar

Employee Advisor

@islandgirl23 quick check: it goes in if block? If yes evaluate "CARDS.resolveNode("Table1[" + this.parent.parent.parent.index + "]").somExpression" 

 

rest should not be an issue.

Avatar

Correct answer by
Level 5

Yes, SOM expression could be the issue. If you can share the form I can check. 
thanks

Avatar

Level 5

I am able to replicate the issue and have fixed this.

Use the below code and remove all the (Use name) data-binding from the table, rows, and from all fields inside the rows.

if (xfa.host.messageBox("Are you sure you want to erase all entries?", "Reset the form", 2,2) === 4){
xfa.host.messageBox("All entries have been removed");
xfa.host.resetData(this.parent.parent.parent.somExpression);
}
else {
xfa.host.messageBox("No entries have been removed");
}

Avatar

Level 5

Good day,

It's not working. I replaced the script in the "erase" button with the above script and it's still performing the same.

Thanks

Avatar

Level 5

You also need to remove the "Use name" data binding as I mentioned in the previous post.

Avatar

Level 5

Thank you.  By removing the "Use name" data binding, would this also effect the functioning of the "similar" button I have on the form?

Avatar

Correct answer by
Level 5

It won’t