Kaynağa Gözat

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
Alexandre Alapetite 6 yıl önce
ebeveyn
işleme
f2e0f051aa
1 değiştirilmiş dosya ile 7 ekleme ve 3 silme
  1. 7 3
      p/scripts/extra.js

+ 7 - 3
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;
 					}
 				};