We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I have an OnDocFormSave plugin that processes the *content field, does stuff with what it finds, then clears out the content field and re-saves the document. I would like to then force a reload of the Document Form so the user sees that the data has been cleared out. Is there a way to do that?
      • 3749
      • 24,544 Posts
      You might try this at the end of your plugin:

      $docId = $resource->get('id');
      $modx->sendRedirect('http://yoursite.com/manager?a=30&id=' . $docId);


      You may need one or both of these above that code:

      $modx->reloadContext('mgr');
      $modx->reloadContext('web');
        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
      • That was pretty much what I had tried, although without the reloadContext() calls. However, with or without those calls, I'm getting an endless "Please Wait..." save when I have the sendRedirect() call in there.
          • 3749
          • 24,544 Posts
          I can't think why that would be. I know you can redirect in a plugin, but maybe not for *that* event.

          The only thing I can think of is doing something like setting a $_SESSION variable in your plugn and having a section connected to OnDocFormPrerender that clears the $_SESSION variable and clears the content field. With things set to "Continue Editing" (the little icon at the upper right) you should see an empty content field.
            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
            • 12066
            • 48 Posts
            Hi @jrotering,

            I'm currently dealing with the same problem. Did you find a solution for successful redirection after 'OnDocFormSave'?

            Thanks