locked
Set background colour of a form field in CRM 2011 RRS feed

  • Question

  • We used this code in CRM 4 to change the background colour of the telephone field on a form.

     crmForm.all.telephone1.style.backgroundColor = "#ffb6c1";

    Now in CRM 2011 I thought it would be something like this.

    Xrm.Page.getAttribute("telephone1").style.backgroundColor = "#ffb6c1";

    This doesn't work of course.

    Is there a supported way of achieving the same thing in 2011?

    Monday, February 4, 2013 11:42 AM

Answers

All replies

  • try this 

    document.getElementById(fieldname).style.backgroundColor = "colorname";

    or

    var varList = crmForm.all.fieldname;

        varList.options[indexnumber].style.backgroundColor = colorname;
       
    OR  
       
        var varOption = varList.options[index];
        varOption.style.backgroundColor = color;
     


    Thanks in Advance Siva


    • Edited by samcrm Monday, February 4, 2013 11:51 AM
    Monday, February 4, 2013 11:50 AM
  • Hello,

    There is no supported way to do that. You can try to use following code:

    document.getElementById('telephone1).style.backgroundColor = "#ffb6c1";


    Freelance Developer for Dynamics CRM 4.0/2011

    • Marked as answer by STHook Monday, February 4, 2013 11:56 AM
    Monday, February 4, 2013 11:53 AM
    Moderator
  • Hi,

    Try these links:

    http://community.dynamics.com/product/crm/f/117/p/79257/147483.aspx

    https://community.dynamics.com/product/crm/f/117/p/79257/147366.aspx


    Naren

    Monday, February 4, 2013 11:56 AM