Hello,
I have a searched but could not find any info on this.
Is there a way using standard Revo methods to have a document save event canceled and a ModX manager standard JS popup called that will display a custom error message.
For example, say that a required TV called "Cars" is not set, would I through a plugin be able to prevent saving and display a JS popup in the manager that says "Please enter a car value"?
Any help is greatly appreciated.
-
☆ A M B ☆
- 24,524 Posts
Evo or Revo?
[edit]Well guess what I found...
http://modx.com/extras/package/mmrequirefieldsformanagermanager
If Evo, you could use the webAlert API function
http://wiki.modxcms.com/index.php/API:webAlert combined with sendRedirect. You might need to turn off the feature of validating the server referal value in the site Configuration. Use onDocFormSave, so that it will fire after the resource is available. The user will still be able to ignore the message, but at least he’ll be reminded.
if(!isset($_POST['whatever'])) {
$modx->webAlert('Whatever TV is required');
$modx->sendRedirect(MODX_MANAGER_URL . 'index.php?a=27&id=' . $id,'','REDIRECT_REFRESH');
};
If you use onBeforeDocFormSave he’ll get sent back to an empty form; a rather harsh reminder to pay attention.
Again with Evo, you would probably be better off creating a ManagerManager extension to do it in javascript in the browser before the form is submitted.