We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22770
    • 285 Posts
    Despite my pleas, I can’t stop my users pasting from Word into TinyMCE. So, I want to filter the selected fields and TVs to strip out the most common Word irritations that are creeping in. I assume that the best place for this to happen would be when a document is saved. I assume, also, that I need to write a plugin to do this.

    But what system events would I want to use for this? For the document fields, would it be OnBeforeDocFormSave or OnDocFormSave? For TVs, would it be OnBeforeTVFormSave or OnTVFormSave? And how could I target it so that it only worked with certain TVs/document fields?

    Any (other) suggestions very gratefully received!
      • 10487 MODX Staff
      • 1,535 Posts
      For your first question, it would be OnBeforeDocFormSave - this event happens immediately prior to the content being saved whereas the OnDocFormSave event happens immediately after the document is saved. The OnBeforeTVFormSave and OnTVFormSave only apply to the TV definition section under ’Manage Resource’ which I don’t think you’ll need in this instance.

      I’ve just ran out of time on my lunch break so I’ll come back to your second question later on (unless somebody answers in between times)
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 22770
        • 285 Posts
        Thanks, Garry! I’ll get started with that.