Expand my Community achievements bar.

SOLVED

Hide subform when drop-down is null

Avatar

Level 9

I am trying to make a subform "hidden" when a dropdown object is null and "visible" when that drop-down is not null. I am using the following script:

if (this.rawValue = null){

xfa.resolveNode("Subform3.#subform.GroupLeader").presence = "hidden";

}

else {

xfa.resolveNode("Subform3.#subform.GroupLeader").presence = "visible";

}

Script does not work. Is it wrong or have I got it in the wrong event? (Form ready)

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

For starters I would place this script in the exit event of the dropdown.

Also you have an unnamed subform, which requires you to resolve the node. This is inefficient, so if you name the subform, you will be able to use a simple relative reference (see: http://assure.ly/kUP02y).

The main issue with the script is that when you are testing equality (in the if/else statement), you need to use a double equal sign (==).

So, if you renamed the subform "Subform4:, the script would become:

if (this.rawValue == null) {

     Subform3.Subform4.GroupLeader.presence = "hidden";

}

else {

     Subform3.Subform4.GroupLeader.presence = "visible";

}

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

For starters I would place this script in the exit event of the dropdown.

Also you have an unnamed subform, which requires you to resolve the node. This is inefficient, so if you name the subform, you will be able to use a simple relative reference (see: http://assure.ly/kUP02y).

The main issue with the script is that when you are testing equality (in the if/else statement), you need to use a double equal sign (==).

So, if you renamed the subform "Subform4:, the script would become:

if (this.rawValue == null) {

     Subform3.Subform4.GroupLeader.presence = "hidden";

}

else {

     Subform3.Subform4.GroupLeader.presence = "visible";

}

Hope that helps,

Niall

Avatar

Level 9

Yes - that works great. Thanks so much for your help with this.