Skip to main content
Participant
May 22, 2025
Question

2 styles of fonts to 1 Text field

  • May 22, 2025
  • 3 replies
  • 226 views

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();

3 replies

try67
Community Expert
Community Expert
May 23, 2025

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.

Nancy OShea
Community Expert
Community Expert
May 22, 2025

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

 

 

Nancy O'Shea— Product User & Community Expert
kglad
Community Expert
Community Expert
May 22, 2025

what app?  acrobat pro?

Participant
May 23, 2025

Yes, this is on acrobat pro.

kglad
Community Expert
Community Expert
May 23, 2025

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">