Details
-
Type: Story
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 4.3.0-b1
-
Component/s: None
-
Labels:None
Description
We need the ability, via JavaScript, to disable form submission buttons on submit. It's possible to click a submit button multiple times very quickly to submit the same form more than once. This behavior is generally undesirable, so there should exist a method of disabling that for forms.
- Update the core JavaScript in the admin and client interfaces to support identical functionality of disabling form submission buttons. This can be done by specifying a class on the FORM tag, e.g. "disable-on-submit". By default, all form buttons of type "submit" will be disabled on submit.
However, the FORM tag can specify a data attribute, e.g., "data-disable-on-submit" that contains a class referencing the specific elements to disable.(see CORE-2704)<form class="disable-on-submit"> <input type="text" name="test" value="Test" /> <input type="button" name="button" value="Press Me" /> <input type="submit" name="process" value="Process" /> <button type="submit" name="submit" value="Submit" /> </form>
- The above example, when submitted, will then add a new attribute "disabled='disabled'":
<form class="disable-on-submit"> <input type="text" name="test" value="Test" /> <input type="button" name="button" value="Press Me" disabled="disabled" /> <input type="submit" name="process" value="Process" /> <button type="submit" name="submit" value="Submit" disabled="disabled" /> </form>
- Form submissions that are submitted via AJAX should re-enabled once the AJAX response has been received. Similar to the above, functionality should exist to re-enable disabled submit buttons on a form. NOTE: It may be best for the form to be left alone and have the template itself determine whether to re-enable the button. We might be able to include a function by which to re-enable them, but it would likely need to be called by the template.
- Add additional subtasks here for each plugin that should also be updated.