Skip to main content

Conditionally formatting a text box in Modern UI

  • November 10, 2025
  • 1 reply
  • 50 views

darylbowman
Captain II
Forum|alt.badge.img+15

I recently had the need to style a textbox in Modern UI based on the value of another field.

Acumatica provides an example for styling grid rows here, but the GetRowCss / GetCellCss events do not seem to work for regular form fields. Not knowing TypeScript / JavaScript better, I spent some time trying different ways of doing this, but ended up with this fairly basic HTML block in a screen extension:

<template>
<style>
[data-rating="green"] input {
background-color: #155724 !important;
}
[data-rating="yellow"] input {
background-color: #856404 !important;
}
[data-rating="red"] input {
background-color: #721c24 !important;
}
</style>
<field append="#fsHeader_C" name="UsrDXCommissionRating"
data-rating.bind="Quote.UsrDXGrossProfitPct.value >= 45 ? 'green' : Quote.UsrDXGrossProfitPct.value >= 40 ? 'yellow' : 'red'"></field>
</template>

(this styles the ‘UsrDXCommissionRating’ field conditionally, based on the value of ‘UsrDXGrossProfitPct’)

1 reply

Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • December 9, 2025

Thank you for sharing this tip with the community ​@darylbowman!