Sub-Tab focus from Display to Edit form

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
holtonba
Posts: 7
Joined: Sun Feb 23, 2014

30 Jun 2015

We have a form that contains parent tabs with child (sub-tabs) inside the parent to help organize the information. Is there a way to maintain the focus on the tab that was activated on the Display Form when opening up the Edit Form?

For example, user navigates to the Display form and clicks on parent Tab B and Subtab 3. If the user clicks Edit to open up the respective edit form, can it automatically activate parent Tab B, Subtab 3?

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

02 Jul 2015

Add the following code to your form (for all view types where you want to have this functionality: Display, Edit, New?)

Code: Select all

var contextID = _spPageContextInfo.pageListId+':'+GetUrlKeyValue('ID');

for (id in fd_tabcontrol_ids){
        if (typeof $.cookie("#"+fd_tabcontrol_ids[id]+":"+contextID) !== 'undefined') {
                 $("#"+fd_tabcontrol_ids[id]).tabs('option', 'active', $.cookie("#"+fd_tabcontrol_ids[id]+":"+contextID));
        };
        $.cookie("#"+fd_tabcontrol_ids[id]+":"+contextID, $("#"+fd_tabcontrol_ids[id]).tabs('option', 'active'));
        $("#"+fd_tabcontrol_ids[id]).on( "tabsactivate", function( event, ui ) {
                if(this === event.target)
            {
                        $.cookie('#'+event.currentTarget.id+':'+contextID, ui.newTab.index());
            }
        } );
}

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests