This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
I am importing xml into a form. I have some if expressions to change the state of a field based on the value of xml fields. Here is my expression for the color - initialize event: if (Lv= "blue"){ this.fontColor="0,0,204"; }else if (Lv = "black"){ this.fontColor="0,0,0";} Lv is a field from the original form. Here is what's going on - the first fontColor value in the expression gets applied no matter what Lv is equal to. So in this case, the fontColor ="0,0,204" gets applied even if Lv="black". It's almost as if the event is ingoring if expression and just pickng up the "this.fontColor" statement. Any ideas?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
In your if statement try a double ==, which you use when testing equality. Also if there are only two incoming colours, you could drop the other if statement and just run with an else.
if (Lv.rawValue == "blue")
{
this.fontColor = "0,0,204";
}
else
{
this.fontColor = "0,0,0";
}
Good luck,
Niall
My bad: It depends on how you are bringing in the XML, but I presume Lv is one field receiving XML data. Because the language is javascript, you will need .rawValue for the Lv field.
Views
Replies
Total Likes
Hi,
In your if statement try a double ==, which you use when testing equality. Also if there are only two incoming colours, you could drop the other if statement and just run with an else.
if (Lv.rawValue == "blue")
{
this.fontColor = "0,0,204";
}
else
{
this.fontColor = "0,0,0";
}
Good luck,
Niall
My bad: It depends on how you are bringing in the XML, but I presume Lv is one field receiving XML data. Because the language is javascript, you will need .rawValue for the Lv field.
Views
Replies
Total Likes
Thank you that worked. the double quotes did it.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies