简体   繁体   English

实体表单中的自定义下拉列表 - 访问字段错误CRM2011

[英]Custom Dropdownlist in Entity Form - Access field error CRM2011

I am implementing custom dropdown (select controls) in CRM 2011 entity form. 我正在CRM 2011实体表单中实现自定义下拉列表(选择控件)。 The html of select control is in a html file which i imported as a webresource. 选择控件的html在html文件中,我作为webresource导入。 I have added that webresource in entity form. 我已经以实体形式添加了webresource。 Now in onload function, I am trying to populate that select control with some hard coded values but it shows following error when form loads: 现在在onload函数中,我试图用一些硬编码值填充选择控件,但它在表单加载时显示以下错误:

在此输入图像描述

Here is the onload function: 这是onload函数:

function onload()
{
var select = document.getElementById("WebResource_State").contentWindow.document.getElementById("state");
select.options[select.options.length] = new Option('Text 1', 'Value1');
}

The above error triggers on second line of this function. 上述错误在此函数的第二行触发。 Please suggest what is missing. 请提出遗漏的建议。

thanks 谢谢

Either your select doesn't have an options property, (maybe it needs to be a capital O?) or the options value doesn't have a length. 您的选择没有选项属性(可能需要是大写O?)或者选项值没有长度。 You can use F12 in IE to open up the debugger. 您可以在IE中使用F12打开调试器。 Put a break point on the second line, and when it hits, inspect what properties/methods are available on your select variable. 在第二行放置一个断点,当它命中时,检查select变量上可用的属性/方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM