We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34838
    • 2 Posts
    Hello guys!

    with onbeforedocsave i notice the save process before saving. Is there any possibility to stop that process (something like "return false"...)?

    regards, fabi
      • 3749
      • 24,544 Posts
      I think the save will abort if you return a string containing an error message.

      return; with no return value or return false; should let the save proceed.
        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
        • 39437
        • 13 Posts
        If I return some value from my Plugin, the Message will print to the Logfile:
        [2014-10-03 14:14:16] (ERROR @ /conn-ajax/index.php) [OnBeforeDocFormSave]MESSAGE!
        

        But the resource will be saved :-(.
          MODX Rocks I am so glad that I have found it.
          • 39437
          • 13 Posts
          This is the solution:
          If you send some Output to the user, the document will not be saved:
          $modx->event->output("I won't let you save this!");
          

          That's all you have to do.
            MODX Rocks I am so glad that I have found it.