locked
MS CRM 2013 iFrame Collapsed RRS feed

  • Question

  • Hi all,

    I have added iFrame on form using javascript and added html webresource on it.

    My problem is when I click on any tab it became collapsed. I want to set iFrame in expand mode for all time.

    For more info see below image.

    Image 1:

    Image 2:

    -------

    Thanks


    Tuesday, August 19, 2014 6:41 AM

All replies

  • Waiting... Urgent..

    Tuesday, August 19, 2014 2:57 PM
  • Hello Suresh,

     To clarify, Are you taking about the tab inside your custom page (General, Tab1, Tab2 etc?). If yes, It has nothing to with CRM and more towards your JavaScript on custom page (postback?).

    I added an iframe and clicked on other tabs, the iframe did not collapse.

    Please post the html of page with tabs (your custom page)

    Regards,

    Jithesh.K

    Wednesday, August 20, 2014 4:49 AM
  • Hi Jithesh

    Thanks for response.

    Here is html webresource code where i am getting all tab control with there name and redirecting to particular tab.

    and this html webresource is called in iframe. and in image 2 it is showing that on click of particular tab it is hiding.

    <html><head>
        <meta charset="utf-8">

        <style type="text/css">
            body {
                margin: 0px;
            }
            .inactiveTab:hover {
                cursor:hand;
            }
            .activeTab:hover {
                cursor:hand;
            }
            .inactiveTab:hover {
                background-color:#C2C2C2;
            }
            .inactiveTab {
                background-color:#F3F3F3;
                color:#000000;
                font-family:Segoe UI, Tahoma, Arial;
                font-size:12px;
                padding: 5px 10px 5px 10px;
                margin:0px 4px 0px 0px;
                width:120px;
                text-overflow:ellipsis;
                display: inline-block;
                text-align: center;
                overflow: hidden;
                white-space: nowrap;
            }
            .activeTab {
                background-color:#7A7A7A;
                color:#FFFFFF;
                font-family:Segoe UI, Tahoma, Arial;
                font-size:12px;
                padding: 5px 10px 5px 10px;
                margin:0px 4px 0px 0px;
                width:120px;
                text-overflow:ellipsis;
                display: inline-block;
                text-align: center;
                overflow: hidden;
                white-space: nowrap;
            }
        </style>

        <script src="../ClientGlobalContext.js.aspx" type="text/javascript"></script>
        <script>
            function activateTab(tab) {
                parent.Xrm.Page.ui.tabs.get(tab).setFocus();
                parent.Xrm.Page.ui.tabs.get(tab).setDisplayState("expanded");
                var tabCtrl = document.getElementById('tabCtrl');
                var tabToActivate = document.getElementById(tab);
                for (var i = 0; i < tabCtrl.childNodes.length; i++) {
                    var node = tabCtrl.childNodes[i];
                    if (node.nodeType == 1) { 
                        node.className = (node == tabToActivate) ? "activeTab" : "inactiveTab";
                    }
                }
            }
        </script>
    </head>

    <body>
        <div id="tabCtrl"></div>
        <script>
            var tabs = parent.Xrm.Page.ui.tabs.get();
            for (var t in tabs) {
                var tab = tabs[t];
                var tabStyle = "inactiveTab";
                if (t == 0) {
                    tabStyle = "activeTab"
                }
                document.getElementById("tabCtrl").innerHTML = document.getElementById("tabCtrl").innerHTML + "<span class=" + tabStyle + " id=\"" + tab.getName() + "\" onclick=\"activateTab('" + tab.getName() + "');\">" + tab.getLabel() + "</span>";
            }
        </script>
    </body></html>

    Wednesday, August 20, 2014 5:23 AM
  • Hi Suresh,

     Sorry, this is a bit too much for me to handle. I am not sure why you are trying to mimic CRM4 behavior in CRM2013. Tabs can be by collapsed and expanded using JavaScript. Another solution would be to collapse all the tabs on form load and expand/collapse them as user click the tab display name. The limitation would be having vertical tab behavior instead of horizontal.

    Regards,

    Jithesh

    Thursday, August 21, 2014 11:29 PM
  • Hi Jithesh,

    As account form contain lots of tab, and user do not want to scroll to go to particular tab. As per requirement user want  frame/webresource which contain name of all tab like button on click of that user redirect to that tab. I know there is no supported way to do this thats why using crm4 tabs behavior.

    Another question: 

    Can i fix the tab on form means during scroll tab should be fix. As i want to add one tab on top of the form. and when i scroll down the form,  tab should be fix, it should not be move up. Same as we do on reports like header constant on page and only data move during scroll. If it is possible this can also solve my issue.

    Thanks again.

    Friday, August 22, 2014 5:42 AM
  • Hi Suresh,

     This is a wild Idea. 50/50 chance of working.

    1. default, collapse all tabs and show tabs names as hyperlink.

    2. When user clicks the link, expand the appropriate tab and setfocus to the first control item (that is not readonly or disabled). so that CRM scrolls automatically.

    Good Luck. Better option is to group the controls properly with the help of a BA and show hide sections.

    Regards.,

    Jithesh

    Friday, August 22, 2014 6:43 AM