From c95a0835a72892a83eedd6eda42a1e4b6595e823 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sun, 20 Jul 2014 22:49:46 +0100 Subject: [PATCH] Removed some more readonly-related code. --- resources/report/js/custom.js | 11 +++-------- resources/report/js/script.js | 11 +++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/resources/report/js/custom.js b/resources/report/js/custom.js index 8f785a26..678544c5 100644 --- a/resources/report/js/custom.js +++ b/resources/report/js/custom.js @@ -118,16 +118,11 @@ var pluginCardProto = Object.create(HTMLElement.prototype, { if (evt.target.className.indexOf('accept') != -1) { /* First validate table inputs. */ var inputs = evt.target.parentElement.parentElement.getElementsByTagName('input'); - /* If an input is readonly, it doesn't validate, so check required / value length explicitly. + /* If an input is readonly, it doesn't validate, but that's ok + because the read-only inputs must be valid. */ for (var i = 0; i < inputs.length; ++i) { - if (inputs[i].readOnly) { - if (inputs[i].required && inputs[i].value.length == 0) { - isValid = false; - console.log(inputs[i]); - inputs[i].readOnly = false; - } - } else if (!inputs[i].checkValidity()) { + if (!inputs[i].checkValidity()) { isValid = false; console.log(inputs[i]); } diff --git a/resources/report/js/script.js b/resources/report/js/script.js index 4708ed45..34ac569c 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -272,16 +272,11 @@ function handlePluginDragOver(evt) { function areSettingsValid() { /* First validate table inputs. */ var inputs = document.getElementById('settings').getElementsByTagName('input'); - /* If an input is readonly, it doesn't validate, so check required / value length explicitly. + /* If an input is readonly, it doesn't validate, but that's ok because the + read-only inputs must be valid. */ for (var i = 0; i < inputs.length; ++i) { - if (inputs[i].readOnly) { - if (inputs[i].required && inputs[i].value.length == 0) { - return false; - console.log(inputs[i]); - inputs[i].readOnly = false; - } - } else if (!inputs[i].checkValidity()) { + if (!inputs[i].checkValidity()) { return false; console.log(inputs[i]); }