How to use Action events?

Who would give me an example of using events while saving a document?

I have added the following script to XWiki.JavaScriptExtension:

require(['jquery'], function init() {
document.observe('xwiki:actions:beforeSave', function(event) {
  //'xwiki:inline:save', {originalEvent: event});
  alert('BeforeSave Trigger');
  return XWiki;
}(XWiki || {}));

but when doc saved alert is not displayed.



It appears you’re mixing jQuery code with Prototype.js code which is not good.

Thanks for hint.

I have two save buttons on the form: one saves the values ​​of the selected checkboxes in the Livetable, the other (standard doc Save) - saves the whole document.

I find it so uncomfortable and superfluous and I am looking for a way to do one button :slight_smile: