简体   繁体   English

MS Dynamics CRM 4.0-onChange事件错误

[英]MS Dynamics CRM 4.0 - onChange event error

I have an onChange event that keeps bringing up the error below whenever I preview it. 我有一个onChange事件,每当我预览它时,都会不断在下面显示错误。

'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. 我有一个与选择列表关联的onChange事件,当选择了一个特定选项时,另一个字段未被隐藏。

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 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. 同样,这已经在表单预览中的一些onChange事件中发生,但是一旦发布到实时系统中就不会出错。 Any ideas? 有任何想法吗?

Thank you 谢谢

Brett 布雷特

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. 这可能意味着具有您期望的“ id”值的表单元素实际上不存在, 或者您使用“ id”值不止一次。

Also: that way of accessing elements will only work in IE. 另外:这种访问元素的方式仅在IE中有效。 Maybe that's what you want, but you can make it work in other browsers by using document.getElementById() 也许这就是您想要的,但是您可以通过使用document.getElementById()使它在其他浏览器中工作

Overriding SourceEvent is not the supported way of doing that... 覆盖SourceEvent不是支持的方式...

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 您可能应该使用(if (crmForm.all.yourLookup) { crmForm.all.yourLookup.FireOnChange();}在表单加载中触发OnChange事件,并在该字段的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;

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. 请注意,不支持更改Display CSS元素,但这是这样做的唯一方法,而无需编写自己的ASPX页面。

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

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

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