locked
how to make a tab read only? RRS feed

  • Question

  • I used to use this code i believe, but its not working now (had to restore the entity back to september):

    I do have a tab that is hidden, so i'm not sure what the index number should starting from 0.  either 3 or 4 depending on if you count the hidden tab and start at 0.

        function MgrReviewTabRO() {
            for (var index in crmForm.all) {
                var control = crmForm.all[index];
                var start = "";
                var end = "";
                if (index == "tab4Tab") {
                    start = index;
                }
                if (index == "tab5Tab") {
                    end = index;
                }
                if (control.req && (control.Disabled != null)) {
                    if (end != "tab1Tab") {
                        control.Disabled = true;
                    }
                }
            }
        }
        MgrReviewTabRO();

     


    Withers
    Tuesday, April 6, 2010 10:30 PM

Answers

  • try this:

    var tab = document.all["tab2"];
    
    for (var i = 0; i < tab.all.length; i++) {
        if (tab.all[i].Disabled !== undefined) {
            tab.all[i].Disabled = true;
        }
    }


    Daniel Cai | http://danielcai.blogspot.com
    • Marked as answer by David Withers Wednesday, April 7, 2010 3:36 PM
    Wednesday, April 7, 2010 1:17 AM

All replies

  • I'd think you could just use something like

    var nodes = document.all["tab2Tab"].childNodes;

    for(var x = 0; x < nodes.length; x++) {
           if (nodes[x].req) {
                         nodes[x].Disabled = true;
          }

    }

    I've just batched this up here so haven't test it. Debug through your code and make sure you have the right tab, it starts at 0.


    MSCRM Bing'd - http://bingsoft.wordpress.com
    Tuesday, April 6, 2010 10:56 PM
    Moderator
  • Does nothing, doesn't even cause an error. I tried all tab numbers as well

    Withers
    Tuesday, April 6, 2010 11:12 PM
  • try this:

    var tab = document.all["tab2"];
    
    for (var i = 0; i < tab.all.length; i++) {
        if (tab.all[i].Disabled !== undefined) {
            tab.all[i].Disabled = true;
        }
    }


    Daniel Cai | http://danielcai.blogspot.com
    • Marked as answer by David Withers Wednesday, April 7, 2010 3:36 PM
    Wednesday, April 7, 2010 1:17 AM