Solved

Is there anyway to change Acumatica Screen UI element color conditionally?

  • 24 September 2022
  • 3 replies
  • 365 views

Userlevel 6
Badge +5

Hello,

       I understand we are having yellow alert and also the highlight frames like below.

 

        But I am still curious to ask, is there anyway that we could change the font color of “Credit Hold” to RED?    Only this single element.  No other fields. And also it is only red when it is “Credit hold”, it remains black when open or completed.

icon

Best answer by Nayan Mansinha 27 September 2022, 00:08

View original

3 replies

Userlevel 7
Badge +12

Hi @ray20 

 

Check this https://community.acumatica.com/customizations-187/change-text-colour-on-a-form-9322#post32807

 

Thank you

Userlevel 4
Badge +2

is there anyway that we could change the font color of “Credit Hold” to RED?    Only this single element.  No other fields. And also it is only red when it is “Credit hold”, it remains black when open or completed.

Yes, one need to rely on Javascript for such purpose.  See example below:

    <px:PXDataSource>
...
<ClientEvents CommandPerformed="changeStatusColor" />
</px:PXDataSource>
<script type="text/javascript">
function changeStatusColor(sender, e) {
var edStatus = px_all["ctl00_phF_form_t0_edStatus"];
var edStatusControl = document.getElementById("ctl00_phF_form_t0_edStatus");
if (edStatus && edStatus.value == "N")
edStatusControl.style.color = "#FF0000";
else
edStatusControl.style.color = "#00FF00";
}
</script>

Here, CommandPerformed is raised whenever record is acted upon in terms of loading, navigating, refreshing, actions, etc.  e.command can be checked to see what raised this event.

Userlevel 6
Badge +5

@manikantad18 @nmansinha   Thank you both for your kindly and quickly help . Either looks like a way to go. I will try when needed.  Thank you again.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved