locked
Dynamics Crm 2013 - Set a tab readonly using javascript RRS feed

  • Question

  • Dear all,

    Can anyone help me how to set a tab readonly using javascript on form load.

    Many thanks

    Regards

    Vinay

    Wednesday, January 8, 2014 12:00 PM

All replies

  • Hi,
    you can't set a tab readonly, but you need to set each field inside the tab readonly. You can find an example here:

    http://crmexplorer.com/2011/11/disable-wnable-fields-sections-tabs-and-the-whole-form-in-crm-2011/


    My blog: www.crmanswers.net - Rockstar 365 Profile

    • Proposed as answer by Guido PreiteMVP Wednesday, January 8, 2014 12:04 PM
    Wednesday, January 8, 2014 12:04 PM
  • Hi,

    I have tried the following code, it does not work:

    ///test
    function sectiondisable (sectionname, disablestatus)
    {
        var ctrlName = Xrm.Page.ui.controls.get();
        for(var i in ctrlName) {
             var ctrl = ctrlName[i];
             var ctrlSection = ctrl.getParent().getName();
             if (ctrlSection == sectionname) {
                   ctrl.setDisabled(disablestatus);
            }
        }
    }  // sectiondisable



    function tabdisable ()
    {
    var tabname="tab_2";
    var disablestatus="true";
     var tab = Xrm.Page.ui.tabs.get(tabname);
    alert ("tab name"+tab);
     if (tab == null) 
    {
    alert("Error: The tab: " + tabname + " is not on the form");
    }
     else {
         var tabsections =  tab.sections.get();
         for (var i in tabsections) {
             var secname = tabsections[i].getName();
             sectiondisable(secname, disablestatus);
         }
      }

    Any help would be appreciated.

    Many Thanks

    Regards

    Vinay

    Wednesday, January 8, 2014 12:50 PM