web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Change font of read-only fields in a Form.

(0) ShareShare
ReportReport
Posted on by 12,163

We have certain fields that are read-only as they pull data from our AS400. The default font of a read-only field is a very light grey and is very hard to read. How do I make this font darker and easier to read?

I have come across this .js but have not been able to get it to work:

  1. function setColor() {   
  2.     if (document.getElementById("new_name") != null) {   
  3.         //Add the below line if the field is disabled   
  4.         document.getElementById("new_name").disabled = false;   
  5.         //The below line changes the font color   
  6.         document.getElementById("new_name").style.color = "red";   
  7.     }   
  8. }  

*This post is locked for comments

I have the same question (0)
  • Gus Gonzalez Profile Picture
    27,113 on at

    Joe,

    Check this post and see if you can get some ideas:

    www.zero2ten.com/.../Moving-CRM-2011-Footer-Data-to-Left-Navigation-Pane.aspx

    Good Luck!

  • Joe Woltering Profile Picture
    12,163 on at

    That's a nice idea, but I really would like to just make the font bolder/darker. I have seen the code above referenced a lot on different sites, but have not had any success implementing it myself.

  • Community Member Profile Picture
    on at

    You need to make the field read-only via code and not the UI.  You could do something like this and call it in the form onLoad event:

     

    function customizeFields(){

      document.getElementById("new_name").style.color="black";

      document.getElementById("new_name").style.fontWeight="bold";

      document.getElementById("new_name").readOnly = true;

    }

  • Joe Woltering Profile Picture
    12,163 on at

    Thanks Scott. Just a question, where you have new_name, do I replace that with the field's schema name? And is that with or without the quotations?

    *Update*: Actually I think I got it. I can see that it made the font bolder but it is still somewhat gray as it is a read-only field. Any ideas on how to make it even darker/bolder?

  • Verified answer
    Community Member Profile Picture
    on at

    It would be the name, not schema name - I think its same as schema name just all lowercase.

    So, for example, in account form to make the account name field you would do something like..

    document.getElementById("name").style.color="black";

    And with the quotation.

  • JMdeSingular Profile Picture
    on at

    Hi Scott  and everyone!

    I try to make the library like you

    function setcolor() {

    if (document.getElementById("Alerta") != null) {  

                   document.getElementById("Alerta").style.color = "red";

    }

    }

    And in my case ( crm online 2015), it doesn´t work. Any idea?

  • Community Member Profile Picture
    on at

    When you debug, does it properly locate that element?

  • JMdeSingular Profile Picture
    on at

    Sorry, I am newer! I am edit the resource web and then I add this function to on load event on form. After that I open the form and it doesn't work

    What do I make to locate when I debug?

    Thanks a lot!!

  • Community Member Profile Picture
    on at

    Just add an alert in there to see if it's finding the element.

  • JMdeSingular Profile Picture
    on at

    Hi Scott,

    I have just done it. The function works but the conditional doesn't work.

    I wrote an alerts after first "{" and other one after second "{" . I can see the first alert, but I can't see the second.

    What is it wrong in the condition?

    Thanks Again!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
JS-09031509-0 Profile Picture

JS-09031509-0 3

#3
Ciprian  P Profile Picture

Ciprian P 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans