locked
Background colour using Javascript on CRM 2011 RRS feed

  • Question

  • Hello,

    I'm trying to change the background colour of the backfround that surrounds a field. I'm using the below coding but it only changes the colour inside the field itself, not outside.

    //Change background colour of field
    function ChangeBackgroundColour()
    {
        if (Xrm.Page.getAttribute("new_purchaseprice").getValue() != "")
        {
            document.getElementById("new_retailprice").style.backgroundColor = "yellow";
        }
    }

    Can someone help please.

    Thanks

    Thursday, February 13, 2014 2:50 PM

Answers

  • Hi

    Try this:

    document.getElementById("new_retailprice_c").style.backgroundColor = "yellow";
    document.getElementById("new_retailprice_d").style.backgroundColor = "yellow";

    Keep this in mind, that this is not supported change.

    • Marked as answer by chris29ss Thursday, February 13, 2014 3:55 PM
    Thursday, February 13, 2014 2:59 PM
  • Hi

    Try this:

    document.getElementById("new_retailprice_c").style.backgroundColor = "yellow";
    document.getElementById("new_retailprice_d").style.backgroundColor = "yellow";

    Keep this in mind, that this is not supported change.

    What relevance does the _c & _d have to the field?

    It worked anyhow, thanks.

    Looks like

    _c changes the label block color

    _d changes the field border color

    • Marked as answer by chris29ss Thursday, February 13, 2014 4:36 PM
    Thursday, February 13, 2014 4:36 PM

All replies

  • Hi

    Try this:

    document.getElementById("new_retailprice_c").style.backgroundColor = "yellow";
    document.getElementById("new_retailprice_d").style.backgroundColor = "yellow";

    Keep this in mind, that this is not supported change.

    • Marked as answer by chris29ss Thursday, February 13, 2014 3:55 PM
    Thursday, February 13, 2014 2:59 PM
  • Hi

    Try this:

    document.getElementById("new_retailprice_c").style.backgroundColor = "yellow";
    document.getElementById("new_retailprice_d").style.backgroundColor = "yellow";

    Keep this in mind, that this is not supported change.

    What relevance does the _c & _d have to the field?

    It worked anyhow, thanks.

    Thursday, February 13, 2014 3:55 PM
  • Hi

    Try this:

    document.getElementById("new_retailprice_c").style.backgroundColor = "yellow";
    document.getElementById("new_retailprice_d").style.backgroundColor = "yellow";

    Keep this in mind, that this is not supported change.

    What relevance does the _c & _d have to the field?

    It worked anyhow, thanks.

    Looks like

    _c changes the label block color

    _d changes the field border color

    • Marked as answer by chris29ss Thursday, February 13, 2014 4:36 PM
    Thursday, February 13, 2014 4:36 PM