Skip to main content
Known Participant
May 22, 2025 4:10 PM UTC
Question

2 styles of fonts to 1 Text field

I have a Text field that is combining multiple text fields to 1. I would like to know if its possible to have variable email as one front while the remaining be another font. I was able to understand "event.change" with upper and lowercase text and curious if this can be implemanted with fonts and/or colors.

 

The string planing to change is below.

 

//set variables
var one = this.getField("Combo1");
var five = this.getField("Email");
var six = this.getField("Office");
var seven = this.getField("Cell");



//Commands
//1 Line
if (five.value != "" && six.value == "" && seven.value == "") { one.value = "\n" + "\n" + five.valueAsString; }
else if (five.value == "" && six.value != "" && seven.value == "") { one.value = "\n" + "\n" + "Office: " + six.valueAsString; }
else if (five.value == "" && six.value == "" && seven.value != "") { one.value = "\n" + "\n" + "Cell: " + seven.valueAsString; }
else if (five.value == "" && six.value != "" && seven.value != "") { one.value = "\n" + "Office: " + six.valueAsString + "\n" + "Cell: " + seven.valueAsString; }
else if (five.value != "" && six.value == "" && seven.value != "") { one.value = "\n" + five.valueAsString + "\n" + "\n" + "Cell: " + seven.valueAsString; }
else if (five.value != "" && six.value != "" && seven.value == "") { one.value = "\n" + five.valueAsString + "\n" + "\n" + "Office: " + six.valueAsString; }
else if (five.value != "" && six.value != "" && seven.value != "") { one.value = five.valueAsString + "\n" + "Office: " + six.valueAsString + "\n" + "Cell: " + seven.valueAsString; }

else { one.value = ""};

this.calculateNow();

5 replies

try67
Community Expert
Community Expert
May 23, 2025 8:58 PM UTC

Yes, if you set the field as having Rich Text Formatting and then format the value as an array of Span objects and apply it to the richValue property, instead of to value. Consult the documentation of Acrobat JS on how to set up those objects correctly.

 

Also, you don't need the calculateNow() command at the end of your code.

Translate
Nancy OShea
Community Expert
Community Expert
May 22, 2025 10:06 PM UTC

If you're using Adobe Experience Manager Forms, please see below for the AEM product community.  

Experience League is on a separate platform from this one.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-forms/ct-p/adobe-experience-manager-forms-community

 

 

Translate
Nancy O'Shea— Product User & Community Expert
kglad
Community Expert
Community Expert
May 22, 2025 4:20 PM UTC

what app?  acrobat pro?

Translate
Known Participant
May 23, 2025 12:59 PM UTC

Yes, this is on acrobat pro.

Translate
kglad
Community Expert
Community Expert
May 23, 2025 2:05 PM UTC

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">
Translate