【发布时间】:2013-11-26 16:30:04
【问题描述】:
我想在 CRM 2011 表单上放置一个按钮。
function create_button(fldName, btnLabel, btnWidth, evt)
{
try{
fldName = "inmate_button_submit";
btnLable="Click Me";
// btnWidth="200px";
var btn = '<button class="ms-crm-Button" onclick="evt()" style="width:50px" id="' + fldName + '" onmouseover="Mscrm.ButtonUtils.hoverOn(this);" onmouseout="Mscrm.ButtonUtils.hoverOff(this);" >Click Me</button>';
var ctrl = null;
try {
ctrl = Xrm.Page.ui.controls.get(fldName).get_chromeElement()[0];
} catch (e) {
ctrl = Xrm.Page.ui.controls.get(fldName)._control.get_element();
}
// Add the new button
ctrl.innerHTML += btn;
// Hide the textbox
ctrl.children[0].style.display = 'none';
ctrl.children[1].style.display = 'none';
// Hide the label
Xrm.Page.ui.controls.get(fldName).setLabel(btnLable);
// Add Event to the newly created button
ctrl.children[0].attachEvent('onclick', evt);
}
catch(e){alert(e.description);}
}
function evt()
{
alert("You have clicked me!!");
}
以上是将按钮放置在表单上的以下代码。当我单击按钮时,在显示警报 crm 后给我以下错误。
错误 发生了错误。 再次尝试此操作。如果问题仍然存在,请查看 Microsoft Dynamics CRM 社区或您的解决方案或联系....
我不知道为什么会这样。有帮助吗?
【问题讨论】:
标签: javascript dynamics-crm-2011 dynamics-crm