We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Quote from: lukemcd at Apr 20, 2011, 09:55 PM

    I found the OnResourceTVFormPrerender system event which fires both when you open a resource (or select New Resource) and when you change the template of a resource. Ideally this would be where the code would check the selected template and update the parent id accordingly. But it doesn’t look like the Parent Resource field re-renders on this event.

    I don’t think that event fires until the user clicks on the TV tab (too late for your purposes), though I could be wrong. You might be able to alter the Parent Resource field with JS at that point, but I’m not sure how you would do that.
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 17667
      • 108 Posts
      There is nothing in $_REQUEST[’template’] when used with OnDocFormPrerender. These are the keys that were output under $_REQUEST when I created a new document:
      a
      __utma
      __utmz
      tinymcePasteText
      ys-modx-element-tree
      PHPSESSID
      ys-modx-leftbar-state
      ys-modx-resource-tree
      ys-modx-file-tree
      ys-ext-gen52
      ys-ext-gen334
      ys-ext-gen395
      ys-ext-gen409
      ys-ext-gen324
      ys-ext-gen327
      ys-access-tabpanel
      ys-modx-tree-usergroup
      wooMeta
      wooTracker


      In my tests OnResourceTVFormPrerender fires even without switching over to the template variables tab.

      Thanks for your help, I may look at using Javascript.