Skip to main content
Known Participant
Sep 26, 2017 11:41 PM UTC
Question

Underlining a Single Word within a Text Field in Acrobat DC

I would like to know if it is possible to underline a word within a text field. In my example below I want to underline the word MINOR: only.

This is my coding:

event.value="MINOR: " + this.getField(“BName”).valueAsString;

I want the above to look like this:

MINOR: Jane Doe

Is this possible?

Thank you

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Bernd Alheit
Community Expert
Community Expert
Sep 27, 2017 4:31 AM UTC

This is possible. Use rich text format in the text field and the JavaScript span object.

Translate
Angus24Author
Known Participant
Sep 27, 2017 8:52 PM UTC

Thanks for your response Bernd, but I'm still at a loss on how to do this.

Can you help me out with the coding for this?

Translate
Joel Geraci
Community Expert
Community Expert
Sep 27, 2017 9:18 PM UTC

See the documentation at the link below

Acrobat DC SDK Documentation

Example 1 will show you how to underline some text.

Example 2 shows you the rest of what you need to do to construct a set of span objects that have different formatting and then set that as the rich text value. In your use case, you'd need two spans.

Translate