MS Dynamics CRM 4.0 - onChange 事件错误
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不支持重写 SourceEvent 方法...
您应该使用
(if (crmForm.all.yourLookup) { crmForm.all 在表单加载中触发
并在字段的 javascriptOnChange
事件.yourLookup.FireOnChange();}onChange
事件中写入类似注释的内容,即不支持更改 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 javascriptonChange
event write something likenote 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
这可能意味着具有您期望的“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()