Expand my Community achievements bar.

checkbox hides the row in the first table only

Avatar

Level 6

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"

 

3 Replies

Avatar

Level 10

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";
}

 

Avatar

Level 6

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.

Avatar

Level 6

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.