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?
-
- 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');
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.
-
- 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.
-
- 48 Posts
Hi @jrotering,
I'm currently dealing with the same problem. Did you find a solution for successful redirection after 'OnDocFormSave'?
Thanks