TIP MultiSaveContrib is not installed on Foswiki.org.


Json-RPC interface to save multiple changes in one transaction

MultiSaveContrib can be used to build wiki applications that change one or more properties in multiple topics in one transaction. So users won't have to edit each single topic turn by turn. All changes are submitted to a multi-save backend which then applies them automatically. By now, only DataForm properties can be changed. A further version of this extension will allow to change other properties as well.

This extension is heavily inspired by Foswiki:Extensions/MultiTopicSavePlugin but strips down some of its features while adding new ones thus rendering its interface incompatible to MultiTopicSavePlugin. The basic idea how to transmit a multi-save change still remains similarly.

Rendering of input forms is best delegated to Foswiki:Extensions/FlexFormPlugin which will use the Foswiki's core features to render DataForm edit widgets.


A multi-save form is created using a formatted search like this:

<form class="jqMultiSave" name="MyMultiSave">
  header="<table class='foswikiTable'>
  format="<tr><td> [[$web.$topic]] </td><td> 
      fields=\"Field1, Field2, Field3\"
      separator=\" </td><td> \"
%BUTTON{"Save" icon="disk" type="submit"}%

There are a couple of things to note:

There's a %JQREQUIRE{"multisave"}% that will load the javascript required to handle all forms having a css class "jqMultiSave" This will attach a jquery.multisave instance to this form.

The multi-save form will be posted to the appropriate jsonrpc endpoint of this extension asynchronously.

Results by the jsonrpc endpoint are processed by the jquery.multisave javascript code and displayed in a message box following the form.

The multi-save action will also transmit the form's name which helps to identify it from other multi-save wiki applications in subsequent beforeSaveHandler and afterSaveHandler (see below).

The formatted search in the example looks up topics that have a specific TestForm attached to it. In this example TestForm comprises of at least three formfield Field1, Field2, Field3.

The formatted search makes use of FlexFormPlugin's %RENDERFOREDIT macro that will generate the edit interface based on the DataForm definition of TestForm.

The form elements used to edit each formfield requires it's name attribute to be altered in a specific way so that MultiSaveContrib knows where to save this formfield. It must be of the form


For instance, the Field1_name parameter in the example above will override the normal name attribute used by %RENDERFOREDIT while creating an edit widget for that element. So changing Field1 in a topic FooWeb.BarTopic will performed by an form element such as:

<input type="text" size="75" name="multisave{FooWeb.BarTopic}{Field1}" value="..." />

All form elements that changed their values will be flagged so using css automatically. Only these will be transferred to the multi-save backend.

Adding beforeSaveHander and afterSaveHandler

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.


Author(s): Michael Daum
Copyright: © 2013-2014 Michael Daum http://michaeldaumconsulting.com
License: GPL (Gnu General Public License)
Release: 1.10
Version: 1.10
Change History:  
20 Sep 2014: fixed saving of deselected checkboxes and radioboxes
04 Sep 2013: fixed manifest
30 May 2013: initial release
Home page: Foswiki:Extensions/MultiSaveContrib
Support: Foswiki:Support/MultiSaveContrib
Topic revision: r4 - 29 Oct 2014, MichaelDaum - This page was cached on 15 Feb 2017 - 07:38.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License