Default tab selecting in manager resource editing

Is there a way to “auto-select” (say for instance) the tab “template variables” in the update resource screen in the manager?

Default is the “page” tab. But while using form-customization for my clients i want them to automaticly go to the TV-tab when they edit a specific resource. Instead of the “page” tab, where they can only edit the pagetitle and alias.

I use the Quickstart-buttons extra to route the client to the correct documents fast.

Interesting question. I don’t know the answer to that but maybe you can change the order of the tabs in form customization?

Hi, here’s some basic plugin logic for switching to the TV tab in the resource view (attach it to the OnDocFormPrerender event):

<?php
$eventName = $modx->event->name;
switch ($eventName) {
    case 'OnDocFormPrerender':
        $modx->regClientStartupScript('
            <script type="text/javascript">
                Ext.onReady(function() {
                    var tabPanel = Ext.getCmp("modx-resource-tabs");
                    tabPanel.setActiveTab(tabPanel.items.findIndex("id", "modx-panel-resource-tv"));
                });
            </script>
        ');
        break;
    default:
        break;
}
3 Likes