My former post highlighted the fact that the 4.0 syntax (unsupported though it was) no longer works in CRM 2011 and in fact has a lot more nefarious side effects than just not working as it should...
So how can the OnClick event be replicated in CRM 2011? The inspiration for my answer was provided from this post. I took the example that was provided and stripped it down to the following function:
function RegisterOnClickEvent(attr, fn) {
var e = document.getElementById(attr);
var f = "var click=function() { " +
fn + "(); " +
" };";
eval(f);
// Attach to click event
e.attachEvent("onclick", click, false);
}
Thereafter all you need to do to register an OnClick event for a bit field is to pass the following function call:
RegisterOnClickEvent("attribname","functionname");
The intention of this blog is to focus on the business application of Microsoft CRM and its surrounding ecosystem. In doing so, whenever discussing a topic I will endeavor to avoid presenting dry facts but rather to relate it to the practical application and/or impact it might have on the business, the pros, cons, best practices etc. The correct way of thinking is paramount when confronting a business challenge and this is what I hope to bring to the table.
No comments:
Post a Comment