Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Variable field problem

Avatar

Level 5

I have placed it change event under TextField1

if (TextField1.rawValue="We")

TextField2.rawValue = "are";

else if (TextField1.rawValue="I")

TextField2.rawValue = "am";

When I type "I'' in TextField1, TextField2 always shows are.

What is the correct code and where should I place?

1 Accepted Solution

Avatar

Correct answer by
Level 4

Yes, there is a assignment error you are not taken care off.

if (TextField1.rawValue="We")   -------> here you are actually assigning the value "We" to text field

TextField2.rawValue = "are";

else if (TextField1.rawValue="I")

TextField2.rawValue = "am";


use this code, it works

if (TextField1.rawValue == "We")   -------> use comparision operator NOT assignment operator,

TextField2.rawValue = "are";

else if (TextField1.rawValue == "I")

TextField2.rawValue = "am";

try this.

thanks,

Rajesh

View solution in original post

2 Replies

Avatar

Correct answer by
Level 4

Yes, there is a assignment error you are not taken care off.

if (TextField1.rawValue="We")   -------> here you are actually assigning the value "We" to text field

TextField2.rawValue = "are";

else if (TextField1.rawValue="I")

TextField2.rawValue = "am";


use this code, it works

if (TextField1.rawValue == "We")   -------> use comparision operator NOT assignment operator,

TextField2.rawValue = "are";

else if (TextField1.rawValue == "I")

TextField2.rawValue = "am";

try this.

thanks,

Rajesh