settings: Avoid duplicate form handlers.

For forms that are built early in setting up the settings panel,
we don't want to attach multiple submit handlers every time we
go into the gear menu, so we use "off" to clear any old handlers.

We also attach handlers directly to the form, instead of
using delegation up to the container div.
This commit is contained in:
Steve Howell
2018-03-25 09:46:34 -04:00
committed by Tim Abbott
parent e30b619ad5
commit aac76c14bd
6 changed files with 13 additions and 12 deletions

View File

@@ -282,7 +282,7 @@ exports.set_up = function () {
meta.loaded = true;
exports.populate_user_groups();
$(".organization").on("submit", "form.admin-user-group-form", function (e) {
$(".organization form.admin-user-group-form").off("submit").on("submit", function (e) {
e.preventDefault();
e.stopPropagation();