Skip to main content
Solved

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

  • September 24, 2022
  • 3 replies
  • 577 views

Forum|alt.badge.img+5
  • Captain II
  • 398 replies

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.

Best answer by Nayan Mansinha

ray20 wrote:

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.

View original
Did this topic help you find an answer to your question?

Manikanta Dhulipudi
Captain II
Forum|alt.badge.img+13

Nayan Mansinha
Community Manager
Forum|alt.badge.img+2
  • Acumatica Developer Support
  • 49 replies
  • Answer
  • September 26, 2022
ray20 wrote:

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.


Forum|alt.badge.img+5
  • Captain II
  • September 30, 2022

@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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings