MS Dynamics CRM 4.0 - onChange 事件错误

发布于 2024-09-04 06:12:51 字数 846 浏览 8 评论 0原文

我有一个 onChange 事件,每当我预览它时,它都会不断出现下面的错误。

“对象不支持此属性或方法”

我有与选项列表关联的 onChange 事件,并且当选择特定选项时,另一个字段将取消隐藏。

代码如下:

onLoad:

//If How did you hear about us is set to event show the Source Event lookup
crmForm.SourceEvent = function SourceEvent() 
{
if (crmForm.all.gcs_howdidyouhearaboutus.DataValue == 5)
{
crmForm.all.gcs_sourceeventid_c.style.display = '' ;
crmForm.all.gcs_sourceeventid_d.style.display = '' ;
}
else
{
crmForm.all.gcs_sourceeventid_c.style.display = 'none' ;
crmForm.all.gcs_sourceeventid_d.style.display = 'none' ;
}
}
crmForm.SourceEvent() ;

onChange

crmForm.SourceEvent() ;

如果有人能让我知道为什么会出现此错误,那就太好了?

此外,这种情况发生在表单预览上的一些 onChange 事件上,但一旦发布到实时系统上,它就不会出错。有什么想法吗?

谢谢布雷特

I have an onChange event that keeps bringing up the error below whenever I preview it.

'Object doesnt support this property or method'

I have the onChange event associated with a picklist and when a specific option is selected another field is unhidden.

The code is below:

onLoad:

//If How did you hear about us is set to event show the Source Event lookup
crmForm.SourceEvent = function SourceEvent() 
{
if (crmForm.all.gcs_howdidyouhearaboutus.DataValue == 5)
{
crmForm.all.gcs_sourceeventid_c.style.display = '' ;
crmForm.all.gcs_sourceeventid_d.style.display = '' ;
}
else
{
crmForm.all.gcs_sourceeventid_c.style.display = 'none' ;
crmForm.all.gcs_sourceeventid_d.style.display = 'none' ;
}
}
crmForm.SourceEvent() ;

onChange

crmForm.SourceEvent() ;

Would be great if someone could let me know why this error is showing up?

Also, this has happened on a few onChange events on the form preview but once published onto the live system it does not error. Any ideas?

Thank you

Brett

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

久随 2024-09-11 06:12:52

不支持重写 SourceEvent 方法...

您应该使用 (if (crmForm.all.yourLookup) { crmForm.all 在表单加载中触发 OnChange 事件.yourLookup.FireOnChange();} 并在字段的 javascript onChange 事件中写入类似

var displayStyle = (crmForm.all.cf_picklist.DataValue == "3") ? "none" : "";
crmForm.all.cf_lookupid_d.style.display = displayStyle;
crmForm.all.cf_lookupid_c.style.display = displayStyle;

注释的内容,即不支持更改 Display CSS 元素,但这是执行此操作的唯一方法,无需编写您自己的 ASPX 页面:

http: //www.eggheadcafe.com/software/aspnet/31267662/hide-lookup-based-on-pick.aspx

Overriding SourceEvent is not the supported way of doing that...

You should probably use the fire the OnChange event in the form load using (if (crmForm.all.yourLookup) { crmForm.all.yourLookup.FireOnChange();} and in the field's javascript onChange event write something like

var displayStyle = (crmForm.all.cf_picklist.DataValue == "3") ? "none" : "";
crmForm.all.cf_lookupid_d.style.display = displayStyle;
crmForm.all.cf_lookupid_c.style.display = displayStyle;

note that changing the Display CSS element is not supported, but it's the only way of doing that, without writing your own ASPX page.

ref: http://www.eggheadcafe.com/software/aspnet/31267662/hide-lookup-based-on-pick.aspx

謌踐踏愛綪 2024-09-11 06:12:52

这可能意味着具有您期望的“id”值的表单元素实际上并不存在,或者您已经多次使用“id”值。

另外:这种访问元素的方式仅适用于 IE。也许这就是您想要的,但您可以使用 document.getElementById() 使其在其他浏览器中工作

It probably means that either form elements with the "id" values you expect don't actually exist, or that you've used an "id" value more than once.

Also: that way of accessing elements will only work in IE. Maybe that's what you want, but you can make it work in other browsers by using document.getElementById()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文