From c0fe5487f4c46ac05a5a2bda40e0d8150bf38690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 5 Oct 2020 02:37:17 +0200 Subject: Bind new form for cloned events. --- static/script.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/static/script.js b/static/script.js index f116deaf..d218bf9f 100644 --- a/static/script.js +++ b/static/script.js @@ -64,6 +64,11 @@ class EventCreator { let event = document.getElementById("event-template").firstChild.cloneNode(true); let popup = document.getElementById("popup-template").firstChild.cloneNode(true); + popup.getElementsByClassName("edit-form")[0].onsubmit = function () { + create_event(event); + return false; /* stop default */ + } + let id = gensym ("__js_event"); // TODO remove button? @@ -577,8 +582,7 @@ window.onload = function () { /* TODO this doesn't yet apply to newly created events */ let popup = document.getElementById("popup" + el.id); - let form = popup.getElementsByClassName("edit-form")[0]; - form.onsubmit = function () { + popup.getElementsByClassName("edit-form")[0].onsubmit = function () { create_event(el); return false; /* stop default */ } -- cgit v1.2.3