From f2e0f051aa52fcf189840ef4b1f5d7dc1ee087f5 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 12 Apr 2020 16:40:06 +0200 Subject: Fix JS for statistics repartition select form (#2896) * Fix JS for statistics repartition select form Error was: `s.form is null in extra.js:166:7` At the same time, disable the form and clears the value while waiting for the next page to load, to better understand what is happening. * Whitespace --- p/scripts/extra.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'p/scripts/extra.js') diff --git a/p/scripts/extra.js b/p/scripts/extra.js index 9ce0e74ce..86ee61542 100644 --- a/p/scripts/extra.js +++ b/p/scripts/extra.js @@ -163,9 +163,13 @@ function init_select_observers() { const opt = s.options[s.selectedIndex], url = opt.getAttribute('data-url'); if (url) { - s.form.querySelectorAll('[type=submit]').forEach(function (b) { - b.disabled = true; - }); + s.disabled = true; + s.value = ''; + if (s.form) { + s.form.querySelectorAll('[type=submit]').forEach(function (b) { + b.disabled = true; + }); + } location.href = url; } }; -- cgit v1.2.3