Expand my Community achievements bar.

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

font color for part of a text field

Avatar

Level 2

Is it possible to use code to change the font color of part of a text field?

My situation as thus.  The user enters a description string.  On exit a script hides the user field and combines it's value with two static strings to display the combined string in a (now visible) "official" description field.

Is it possible to include tags of some sort to color only the user text as red? So text in one field would appear black red black?

Sorry if this is a repeat question.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

why not using floating fields?

You can easily design a text with 3 floating fields.

Two of them you fill with strings from a script and the other one with the value of the users description string.

The benefit of this method is, you can use individual colors, fonts, sizes etc. for each floating field!

1. Input

Floating1.png

2. Result

Floating2.png

Here's an example form:

https://acrobat.com/#d=rnJO2rOd4FvAn4izbPwN-Q

View solution in original post

6 Replies

Avatar

Former Community Member

It is possible but it would be very compicated as the target field woudl have to be a rich Text field and you woudl have to create xHTML to represent the content of that field and load the xHTML into the field. It will involve lots of scripting.

Do you want to proceed?

Paul

Avatar

Level 2

I haven't touched HTML since Tripod years ago.

Can I set the field as Rich Text and then include HTML coloring codes between the string variables?

Or is it leagues more complicated then that?

Avatar

Level 2

Well then I suppose the benefit against the time it'll probably take isn't going to be worth it for something cosmetic.

Thank you for your help.

P.S.  You don't have to provide a detailed description/example (as I more likely then not won't have time to use it).  But if you would like the "forum" points, you're more then welcomed to provide an informative response for anyone else who happens to find this post.

Avatar

Correct answer by
Level 10

Hi,

why not using floating fields?

You can easily design a text with 3 floating fields.

Two of them you fill with strings from a script and the other one with the value of the users description string.

The benefit of this method is, you can use individual colors, fonts, sizes etc. for each floating field!

1. Input

Floating1.png

2. Result

Floating2.png

Here's an example form:

https://acrobat.com/#d=rnJO2rOd4FvAn4izbPwN-Q

Avatar

Level 2

This is exactly what I was looking for.

Using {} inside a Text object allows you call the value of fields.

And you can make each field called a different color just using the standard font color settings with the {} item in the Text object .

Exactly what I needed.  Too bad I already released my form tied to the OP.  But excellent information for future works!

Thank you for your explaination.