Thursday, July 28, 2011

CRM 2011 OnClick Events

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 + "(); " +  
" };";  

    // 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:


No comments:

Post a Comment