Development Guide

Buttons: Preventing double submission

This feature has been moved to the Kitchen Sink Documentation.

This feature has been introduced for ILIAS 5.0.

To prevent double form submissions a javascript method parses the page content and adds mark-up to certain elements.
See /Services/JavaScript/js/Basic.js - preventDoubleSubmission()
 
This is done automatically for the following HTML elements if they have a CSS class "preventDoubleSubmission":

  • form submits
  • links
  • textareas
 
On click/submit these elements will be deactivated until the next page reload. This leads to a problem if this page reload never happens. Scenarios for this are:
  • file download / export buttons
  • forms in layers
To disable the double submission handling for specific elements add the CSS class "omitPreventDoubleSubmission".

The handling of link- or submit-buttons in ILIAS might be refactored in the near future. It is bad practice to use hard-wired css classes in PHP like "[omit]PreventDoubleSubmission" or "emphSubmit" (for the primary action on a page).

JL 28 Jul 2014: Prototypes for ilLinkButton and ilSubmitButton have been added to the trunk (/Services/UIComponent/Button/). Both ilToolbarGUI[::addButtonInstance()] and ilTable2GUI[::addCommandButtonInstance()] are compatible with these button classes.
The button classes should be used at least in all cases where

  • the primary action is to be marked: ilButton::setPrimary(true);
  • the double submission prevention needs to be disabled: ilButton::setOmitPreventDoubleSubmission();
Please note that ilSubmitButton is not responsible for a valid form action in its context. This still has be done by the respective container, e.g. ilToolbarGUI.