We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11838 ☆ A M B ☆
    • 79 Posts
    Modx revo 2.4.2-pl
    Hello I use form customisation to create a "SEO" tab on documents.
    The problem is the content field displays in all tabs, it feels disturbing to me.
    I've already setted a content tv so i can hide the default content field, it works but for lot of reasons I can't use this solution (there is complication for almost everythingh when you don't use the default content field).
    So my question is there a known way to hide content field from all tabs excepted "Document". Maybe someons has a trick with CSS or something ?
    Thank you

    This question has been answered by hartus. See the first response.

    • discuss.answer
      • 11838 ☆ A M B ☆
      • 79 Posts
      I did a plugin like this on OnDocFormPrerender:

      <?php
      switch ($modx->event->name) {
          // Add a custom tab to the MODX create/edit resource pages
          case 'OnDocFormPrerender':
              $custom_html = 'Your custom HTML, e.g. from a model function or API lookup etc.';
              $modx->regClientStartupHTMLBlock('<script type="text/javascript">
                  Ext.onReady(function(){
          var tabPanel = Ext.getCmp("modx-resource-tabs");
           
          if(tabPanel!=null){
              tabPanel.on(\'tabchange\', function(parent,selectedTab){ 
                  if (selectedTab.id == \'modx-ref\') {
                      Ext.getCmp("modx-resource-content").hide();
                  }
                  else {
                      Ext.getCmp("modx-resource-content").show();
                  }
              });
              tabPanel.insert(0, customTab);
              tabPanel.setActiveTab(0);
              tabPanel.doLayout();
          }
      });               
              </script>');
      }