Changes for page XWiki JavaScript API

Last modified by Simon Urli on 2022/09/14

<
From version < 11.3 >
edited by Vincent Massol
on 2010/12/10
To version < 12.1 >
edited by Sergiu Dumitriu
on 2011/01/12
>
Change comment: Caveat: event.memo.continue is invalid syntax

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.VincentMassol
1 +XWiki.Sergiu
Content
... ... @@ -47,10 +47,10 @@
47 47  * **##xwiki:actions:preview##**
48 48  This event is sent after ther use clicks the "Preview" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually leaving the edit mode.
49 49  * **##xwiki:actions:save##**
50 -This event is sent after the user clicks the "Save" or "Save & Continue" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually submitting the form. A memo is available if you need to know if the intend is to continue after the save, in ##event.memo.continue##. You can use it as follows:(((
50 +This event is sent after the user clicks the "Save" or "Save & Continue" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually submitting the form. A memo is available if you need to know if the intend is to continue after the save, in ##event.memo['continue']##. You can use it as follows:(((
51 51  {{code language="javascript"}}
52 -document.observe("xwiki:dom:loaded", function(event){
53 - var doContinue = event.memo.continue;
52 +document.observe("xwiki:actions:save", function(event){
53 + var doContinue = event.memo['continue'];
54 54   if (doContinue) {
55 55   // do something specific
56 56   }
... ... @@ -57,6 +57,8 @@
57 57  });
58 58  {{/code}})))
59 59  
60 +{{warning}}Caveat: While most properties can be accessed as ##event.memo.property##, this doesn't work with ##event.memo.continue## since ##continue## is a reserved keyword.{{/warning}}
61 +
60 60  All these events contain as extra information, in the second parameter sent to event listeners (the memo), the original click event (if any, and which can be stopped to prevent the action from completing), and the form being submitted, as ##event.memo.originalEvent##, and ##event.memo.form## respectively.
61 61  
62 62  === Document extra events (xwiki.js) ===

Get Connected