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
BedrockMission!

Learn More

View all

Sign in to view all badges

Coloring a text in a string using javascript

Avatar

Avatar
Validate 1
Level 1
tharuny741
Level 1

Likes

2 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
tharuny741
Level 1

Likes

2 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
tharuny741
Level 1

16-08-2018

Hey guys ,

Actually I have a text field which is binded with a long text , need to color a specific character from the string. Got an idea of using replace function  replacing the text with a colored text using javascript , used the following script : (the rawValue contains text "this is only for testing")

var e = "BLAH";

this.font.fill.color.value = "0,56,101";

//e.value.font.fill.color = "0,56,101";

var str = this.rawValue;

str = str.replace(/ only /g, e);

this script works but it colors the entire string , the third line of script does not work(so commented it). Can we set color to the value of the variable e which I've defined above and pass that variable to replace function ???

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,077 posts

Correct Reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,077 posts

Correct Reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile
Magus069
MVP

17-08-2018

Hi there,

here is a link you can refer to help you with this.

Adobe LiveCycle Designer Cookbooks by BR001: Programmatically updating Rich Text (or xHTML)

Answers (0)