Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

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

Avatar

Level 5

Thanks a lot.