From ba2c1e3b0ff95fdacc6455a9847d661ba6a86cdc Mon Sep 17 00:00:00 2001 From: Joshua Rubingh Date: Fri, 29 May 2020 14:40:54 +0200 Subject: [PATCH] Fix stupid IE11... --- .../RUG_template/javascript/formdata.min.js | 18 ++++++++++++++++++ .../apps/RUG_template/templates/base.html | 1 + .../templates/schedule/schedule_new.html | 11 ++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 polyclinic_scheduling/apps/RUG_template/static/RUG_template/javascript/formdata.min.js diff --git a/polyclinic_scheduling/apps/RUG_template/static/RUG_template/javascript/formdata.min.js b/polyclinic_scheduling/apps/RUG_template/static/RUG_template/javascript/formdata.min.js new file mode 100644 index 0000000..a5fde02 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/static/RUG_template/javascript/formdata.min.js @@ -0,0 +1,18 @@ +;(function(){var k;function m(a){var b=0;return function(){return b + diff --git a/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html b/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html index dfa42c3..6e77b8c 100644 --- a/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html +++ b/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html @@ -1073,7 +1073,16 @@ formdata.delete('csrfmiddlewaretoken'); formdata.delete('json'); - jQuery('input#id_json').val(JSON.stringify(Object.fromEntries(formdata))); + // Display the key/value pairs. This is needed to support stupid IE. Mici$oft is still having hardtime playing nice :( + let json_data = {}; + var formDataEntries = formdata.entries(), formDataEntry = formDataEntries.next(), pair; + while (!formDataEntry.done) { + pair = formDataEntry.value; + json_data[pair[0]] = pair[1]; + formDataEntry = formDataEntries.next(); + } + + jQuery('input#id_json').val(JSON.stringify(json_data)); return true; } else { alert('Er zijn wat problemen met het formulier. Controleer de invoer velden');