Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-15709

Stopping the xwiki:actions:* events doesn't stop the submit event that triggered them

    XMLWordPrintable

Details

    • Easy
    • N/A
    • N/A

    Description

      Open a page in edit mode then open the JavaScript console and enter this:

      require(['jquery', 'xwiki-events-bridge'], function($) {
        $(document).on('xwiki:actions:beforeSave', function(event) {
          event.preventDefault()
        });
      });
      

      Save the page. The submit is not prevented.

      The workaround is to stop the original event with:

      require(['jquery', 'xwiki-events-bridge'], function($) {
        $(document).on('xwiki:actions:beforeSave', function(event, data) {
          data.originalEvent.stop();
        });
      });
      

      but this has 2 problems:

      • you need to be aware that the original event exists
      • you need to use old Prototype.js code to stop the event (because the xwiki:actions:* events are triggered from Prototype.js)

      Attachments

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: