Expand my Community achievements bar.

SOLVED

Button clears entries in the floating field in each table created

Avatar

Level 6

Good Day,

My form has a check-box and a radio button in the Master Page. They are set to global.  In one of the rows of my table, I have floating fields within it. The floating field is set to global as well.  When a box is checked or radio button is chosen, a "specific word" is entered in the floating field. Let's say the word entered is "Dog".   I also have a button that adds a table which also copies some of the entries within it.  This works perfectly.  "Dog" is copied as it should be.    I also have a button to clear entries from a specific table.  Here lies the issue:

When I click the button to clear entries from a specific table, it clears the word "Dog" from every table that were created.  I do not want that to happen.  I need for the word "Dog" to stay in all table rows created, including the table that is tied to the " erase specific entries button" when it is clicked.  I tried changing the binding but then the "Dog" is not copied when I click the "create similar" button.  Any help is greatly appreciated.  I'm on a time crunch to get this resolved ASAP.  This is what I have in the erase click button:

 

if (xfa.host.messageBox("You are about to erase all entries in this record. Do you want to proceed?", "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");
}

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

As per the description you mentioned above, the issue is due to global data binding.

Correct the binding, it should work.

View solution in original post

7 Replies

Avatar

Correct answer by
Community Advisor

As per the description you mentioned above, the issue is due to global data binding.

Correct the binding, it should work.

Avatar

Level 6

Good day,

Which bindings should I correct? The one in the master page?  I sent a link to you earlier so that you can see the issue.  Were you able to access it?

 

Avatar

Level 6

Good day,

 I sent it to your gmail account on 2/18/23 as instructed.  Please see another link below.  Your help is greatly appreciated.

 

https://drive.google.com/file/d/1leCpDv7oeYt16kRrfVj9AYzNNsDoAqED/view?usp=share_link

Avatar

Community Advisor

Below is your code on erase button.

I have added the last line to the existing code.

The idea is to set the value again after the reset.

I hope you will get the idea from this.

 

form1.howobtainedsubform.cardssubform.CARDS.Table1.Row12.adddeletesubform.erase::click - (JavaScript, client)
//+ GENERATED - DO NOT EDIT (ID:9E0210A0-B0A5-4253-AA81-36011A4B1679 CRC:1405961094)
//+ Type: Action
//+ Result1: SetFieldValue("$Node2","tovalue","Genuine")
//+ Node2: form1[0].howobtainedsubform[0].cardssubform[0].CARDS[0].Table1[0].Row11[0].descripsubform[0].gen[0]
//+ Node1: form1[0].howobtainedsubform[0].cardssubform[0].CARDS[0].Table1[0].Row12[0].adddeletesubform[0].erase[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: erase.click
this.resolveNode("Row11.descripsubform.gen").rawValue = "Genuine";
//-

if (xfa.host.messageBox("You are about to erase all entries in this record. Do you want to proceed?", "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");
}

this.resolveNode("howobtainedsubform.cardssubform.CARDS.Table1.Row11.descripsubform.cft").rawValue = "set value again";

Avatar

Level 6

Thank you, but I think I will need an "if" statement or something?  It works but both names are set at the same time. It has to work based upon what is checked in the master page.  If "genuine" box is checked then set the "gen" value only.  I added the end code for gen and cft and they both sent again even though only one of the boxes is checked in the master page.