checkbox hides the row in the first table only | Community
Skip to main content
Level 5
March 12, 2023

checkbox hides the row in the first table only

  • March 12, 2023
  • 1 reply
  • 1081 views

Good day,

I have a checkbox in the master page, which when checked, makes visible a row with text field in a table.  I also have a button to add a table and the row is visible when added if the box is checked.  I also have a script in the checkbox that when unchecked, the row in the table hides again.  The problem is that when I uncheck the box, it only hides the row in the first table but not the other tables that were created.  I need to have the row in each table hidden.  I could not find any scripts/information on how to accomplish this.  Please help.  One of the scripts in the checkbox is...

if (this.rawValue == "0") {
this.resolveNode("howobtainedsubform.cardssubform.CARDS.Table1.Row10.encodedinfo").presence = "hidden"

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

radzmar
Level 10
March 12, 2023

You'll have to use resolveNodes() and a loop to update all instances of the buttons.

The method resolveNodes creates a nodeList you can process. Use the accessor [*] to tell it there are multiple instances to resolve. To a resolve a spicific instance use the index number instead of an asterisk. If you don't provide any accessor, it automatically means [0].

Here's a way how it could look like.

var oNodes = xfa.resolveNodes('howobtainedsubform.cardssubform[*].CARDS[*].Table1[*].Row10[*].encodedinfo'); for (var i = 0; i < oNodes.length; i += 1) { oNodes.item(i).prssence = "hidden"; }

 

Level 5
March 20, 2023

Good day,

For some reason, the script is not working.  The script needs to kick in when it's unchecked after being checked.  I entered the incorrect row information in my question.  This is what I have in the "change" of the check box.  

var oNodes = xfa.resolveNodes('howobtainedsubform.cardssubform[*].CARDS[*].Table1[*].Row1[*].type');
for (var i = 0; i < oNodes.length; i += 1) {
oNodes.item(i).presence = "invisible";
}

After the box is unchecked, then the row needs to be hidden in all tables created.  This is so that if the user realizes they made a mistake and checked the box after creating multiple tables, this script will hide the row in all of them at once.

Level 5
April 9, 2023

Good day Radzmar,  

Please see my reply above. Can you help me with the script I entered above?  For some reason it's not working.

Thank you.