locked
Javascript to set fields ready only based on completion of another field RRS feed

  • Question

  • I'm trying to set a field to read only based on the look up field of a related entity being populated. My script is not working

    function setSomeFieldsReadOnly()

    {

                    var val = Xrm.Page.getAttribute("orbus_projectmanagement").getValue();

                    if (val.value.length == 0)

                    {

    Xrm.Page.ui.controls.get("orbus_setupbydate").setDisabled(true);

                    } else {

    Xrm.Page.ui.controls.get("orbus_setupbydate").setDisabled(false);

                    }

    }


    Thursday, October 23, 2014 6:43 PM

Answers

  • try with:

    function setSomeFieldsReadOnly()
    {
    var value = Xrm.Page.getAttribute("orbus_projectmanagement").getValue();
    if (value == null) {
        Xrm.Page.ui.controls.get("orbus_setupbydate").setDisabled(true);
    } else {
        Xrm.Page.ui.controls.get("orbus_setupbydate").setDisabled(false);
    }
    }


    My blog: www.crmanswers.net - Rockstar 365 Profile

    • Marked as answer by Nicole_CRM Monday, October 27, 2014 3:15 PM
    Thursday, October 23, 2014 6:47 PM