We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39506
    • 5 Posts
    Dear all,

    I'm trying to achieve a function that saves all the version of the document resource when the user save it.

    I've looked into /manager/assets/modext/sections/widgets/resource/modx.panel.resource.js and there is the beforeSubmit() function that I think I could add my function in here.

    But I'm wondering if there is anyway that I can intercept that without editing that core file? I saw that http://modx.com/extras/package/versionx has done that? It would be great if I could be pointed to the right place.

    Cheers,
      • 26903
      • 1,336 Posts
      You don't need to do this, you need to listen for the before submit event in your js, something like :-
      listeners: {
      'beforeSubmit': {
      fn:this.beforeSubmit,
      scope:this
      }
      then declare your own beforeSubmit in your scope :-

      beforeSubmit: function(o) {
      /* Change the default waiting message */
      o.config.saveMsg = _('actioning');

      Ext.apply(o.form.baseParams,{

      });
      }

      Where this goes depends on what form/object you are extending of course.
        Use MODx, or the cat gets it!
        • 39506
        • 5 Posts
        Hi shamblett,

        Really appreciate your help. Your code looks like a good example in ExtJS for me.

        I actually found the Plugin can be hooked to OnDocFormSave to perform what I want.

        Just a question though, I can use return to write something to the log file but the function event->output("Some text"); did do anything for me. [following the sample in http://rtfm.modx.com/display/revolution20/Plugins ]

        Is this expected?

        Thanks =)