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

Script to detect subform dynamically set presence

DKinsley
Level 9
Level 9

I have a subform named "QAN" that is hidden until the user clicks a radio button. If this subform is visible when the user clicks a custom e-mail button, I want to write a script that checks to see if the QAN subform is visible. I used the following with no success:

if (this.resolveNode("QAN").presence = "visible"){

   do the following...

Can this script detect the presence of a subform that is dynamically changed from hidden to visible?

1 Accepted Solution
Mandy_Wiesener
Correct answer by
Level 5
Level 5

If you want to check something you have to use == instead of =

If(QAN.presence == "visible")

{

     do the follwing..

}else{}

== is an relational operator

= is an assignment of value (this.rawVaue = 3; means, the current object get the value 3)

Helpful?

Kind regards Mandy

View solution in original post

6 Replies
Mandy_Wiesener
Correct answer by
Level 5
Level 5

If you want to check something you have to use == instead of =

If(QAN.presence == "visible")

{

     do the follwing..

}else{}

== is an relational operator

= is an assignment of value (this.rawVaue = 3; means, the current object get the value 3)

Helpful?

Kind regards Mandy

DKinsley
Level 9
Level 9

The solution is so simple but not if you don't know the answer! Thank you so very much for your help!

-Don

Mandy_Wiesener
Level 5
Level 5

No problem. You're welcome!!

You understand it now?

Mandy

DKinsley
Level 9
Level 9

I was able to get the scrit to work by using == in place of =.

Do you ever use single = sign? I have seen triple === also. What is this for?

Thanks

Jono_Moore
Level 10
Level 10

As Mandy mentioned above above "=" is for assigning a value to something and "==" (or "!=", etc.) is for testing a value.

"===" (and "!==", etc.) is for testing an exact value. JavaScript is called a "loosely typed" language which means that you don't have to specify what type of variable you are using. In languages like Java (strongly typed) you have to specify what type of variable your variable is going to be (integer, string, boolean, etc.).

This can lead to problems sometimes in JavaScript if a number gets converted to a string and then you try to do math with it. By using "===" you can test that the variable is actually a number and not a letter or vice versa.

From some reading I've done it sounds like using "===" is a "best practice" for JavaScript. And it might be faster at performing comparisons, but not sure about that one.

Maybe someone who knows more about JavaScript can explain better.

http://www.w3schools.com/js/js_operators.asp

http://www.w3schools.com/js/js_comparisons.asp

DKinsley
Level 9
Level 9

Thanks Jono. I appreciate you explaining this.

-Don