如何更改 crm 表单中的 html 代码?

how can i change the html code in crm form?

我使用了 dynamics CRM 2015,我想将 OptionSet 类型更改为 checkboxs . 像这样: enter image description here

我的解决方案是使用 JQuery 获取 crm 格式的 td 标签,然后使用 html() 更改 td html 代码。 像这样 $("#ubg_note_d").html()。但问题是我无法得到 td 标签,我想在使用浏览器 DEVELOPER TOOLS 和 select 元素后显示 checkbox.Only 标签,然后我可以获得标签......我已经被这个屏蔽了 1一天,有什么帮助吗?;)

注意:我试过js和jquery,都无法得到td tag.My代码是运行的形式Onload 事件,我尝试了提交的 Onchange 事件,问题仍然存在...

您尝试实现的目标不受支持。相反,您可以通过创建 html Web 资源使用受支持的方式实现相同的效果,稍后可以将其添加到表单中。

网页资源代码如下

<html><head>
    <title></title>
    <script type="text/javascript" src="new_jquery_1.10.2.js"></script>
    <script type="text/javascript">

        // function will be called when web resource is loaded on Form.
        $(document).ready(function () {
            ConvertDropDownToCheckBoxList();
        });

        //Coverts option list to checkbox list.
        function ConvertDropDownToCheckBoxList() {
            var dropdownOptions = parent.Xrm.Page.getAttribute("new_makeyear").getOptions();
            var selectedValue = parent.Xrm.Page.getAttribute("new_selectedyears").getValue();

            $(dropdownOptions).each(function (i, e) {
                var rText = $(this)[0].text;
                var rvalue = $(this)[0].value;
                var isChecked = false;
                if (rText != '') {
                    if (selectedValue != null && selectedValue.indexOf(rvalue) != -1)
                        isChecked = true;

                    var checkbox = "< input type='checkbox' name='r' / >" + rText + ""
                    $(checkbox)
                        .attr("value", rvalue)
                        .attr("checked", isChecked)
                          .attr("id", "id" + rvalue)
                        .click(function () {
                            //To Set Picklist Select Values
                            var selectedOption = parent.Xrm.Page.getAttribute("new_selectedyears").getValue();
                            if (this.checked) {
                                if (selectedOption == null)
                                    selectedOption = rvalue;
                                else
                                    selectedOption = selectedOption + "," + rvalue
                            }
                            else {
                                var tempSelected = rvalue + ",";
                                if (selectedOption.indexOf(tempSelected) != -1)
                                    selectedOption = selectedOption.replace(tempSelected, "");
                                else
                                    selectedOption = selectedOption.replace(rvalue, "");
                            }
                            parent.Xrm.Page.getAttribute("new_selectedyears").setValue(selectedOption);


                            //To Set Picklist Select Text
                            var selectedYear = parent.Xrm.Page.getAttribute("new_selectedyeartext").getValue();
                            if (this.checked) {
                                if (selectedYear == null)
                                    selectedYear = rText;
                                else
                                    selectedYear = selectedYear + "," + rText
                            }
                            else {
                                var tempSelectedtext = rText + ",";
                                if (selectedYear.indexOf(tempSelectedtext) != -1)
                                    selectedYear = selectedYear.replace(tempSelectedtext, "");
                                else
                                    selectedYear = selectedYear.replace(rText, "");
                            }
                            parent.Xrm.Page.getAttribute("new_selectedyeartext").setValue(selectedYear);

                        })
                        .appendTo(checkboxList);
                }
            });
        }
    </script> 
    <meta charset="utf-8">
</head><body>
    <div id="checkboxList">
     
    </div>

</body></html>

参考下面给出的 link for

enter link description here

不需要代码。它只是在 CRM 上配置以更改显示格式:复选框。