Adobe form: set field color dynamically with javascript

Adobe form: set field color dynamically with javascript

To specify with javascript the color for a text field in adobe form, use the code below.


// data.MAIN.SUBFORM.FIELD_TO_CHANGE_COLOR::initialize - (JavaScript, client)
this.font.fill.color.value = "255,0,0"; // Color Red in RGB Color

The color has to be specified in 🔗 RGB format.

Example to set color from another field value

Let’s imagine you want to set the color from ABAP value, one way to proceed is to bind your RGB color to an hidden field Hidden_RGB_COLOR (so this field is not displayed on the form).

To change the field color from this value with the following hierarchy :


// data.MAIN.SUBFORM.FIELD_TO_CHANGE_COLOR::initialize - (JavaScript, client)
var rgbColor = this.parent.Hidden_RGB_COLOR.rawValue;
this.font.fill.color.value = rgbColor;

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV : cv.fjourneau.net.

Leave a Reply