locked
MS CRM 2011 Ribbon button Onclick event not firing RRS feed

  • Question

  • Hi,

    I have a CRM2011 ribbon button which was created which was using XML file and ajax call .it(below function) creates button dynamically and add the button click event. The contained event  "onclick=window.execScript(action)"

    is not working for Chrome and firefox.I tried "eval" but it was not working.

    Please suggest the solution.

    function AddButton(b_title, b_imgurl, appendSeparator, b_url){
         var menuItem = '<LI class="ms-cui-group" id=mnuCatalystSavo title=\"' + b_title + '\" onclick=window.execScript(action) tabIndex=-1 action=\"window.open(\'' + b_url + '\', \'\' , \'status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable\');\"><SPAN class="ms-cui-groupContainer"><br/><A class="ms-cui-ctl-large " onclick=\"return false;\" tabIndex=-1 href=\"javascript:onclick();\" target=_self><IMG class=ms-crm-Menu-ButtonFirst tabIndex=-1 alt=\"' + b_title + '\" src=\"' + b_imgurl + '\"><SPAN class="ms-cui-ctl-largelabel" tabIndex=0></br>' + b_title + '</SPAN></A></SPAN></SPAN></LI>';
       
        if(appendSeparator == true)
            menuItem += '<LI class="ms-cui-group" tabIndex=-1><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></LI>'            
            
            return menuItem;
        }
    Thanks


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Mohammad Yusuf Ansari http://microxrm.blogspot.in

    Thursday, October 16, 2014 9:13 AM

Answers

  • Issue was resolved,

    function AddButton(b_title, b_imgurl, appendSeparator, b_url) {
    
        var ss = "window.open('" + b_url + "', '', 'status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable')"
        // var menuItem = '<LI class="ms-cui-group" id=mnuCatalystSavo title=\"' + b_title + '\" onclick=window.execScript(action) tabIndex=-1 action=\"window.open(\'' + b_url + '\', \'\' , \'status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable\');\"><SPAN class="ms-cui-groupContainer"><br/><A class="ms-cui-ctl-large " onclick=\"return false;\" tabIndex=-1 href=\"javascript:onclick();\" target=_self><IMG class=ms-crm-Menu-ButtonFirst tabIndex=-1 alt=\"' + b_title + '\" src=\"' + b_imgurl + '\"><SPAN class="ms-cui-ctl-largelabel" tabIndex=0></br>' + b_title + '</SPAN></A></SPAN></SPAN></LI>';
        var menuItem = '<LI class="ms-cui-group" id=mnuCatalystSavo title=\"' + b_title + '\" onclick= \"' + ss + '\" tabIndex=-1 action=\"window.open(\'' + b_url + '\', \'\' , \'status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable\');\"><SPAN class="ms-cui-groupContainer"><br/><A class="ms-cui-ctl-large " onclick=\"return false;\" tabIndex=-1 href=\"javascript:onclick();\" target=_self><IMG class=ms-crm-Menu-ButtonFirst tabIndex=-1 alt=\"' + b_title + '\" src=\"' + b_imgurl + '\"><SPAN class="ms-cui-ctl-largelabel" tabIndex=0></br>' + b_title + '</SPAN></A></SPAN></SPAN></LI>';
        if(appendSeparator == true)
            menuItem += '<LI class="ms-cui-group" tabIndex=-1><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></LI>'            
            
            return menuItem;
        }


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Mohammad Yusuf Ansari http://microxrm.blogspot.in

    Friday, October 17, 2014 10:31 AM