diff --git a/UI/GeneralUI.js b/UI/GeneralUI.js index 95802b1..53b33e4 100644 --- a/UI/GeneralUI.js +++ b/UI/GeneralUI.js @@ -98,9 +98,13 @@ export class GeneralUI const length = e.length; for (let i = 0; i < length; ++i) { - e[i].addEventListener('load', function() { - this.height = this.contentWindow.document.body.scrollHeight + 25; - }); + if (e[i].contentWindow.document.readyState === 'complete') { + e[i].height = e[i].contentWindow.document.body.scrollHeight + 25; + } else { + e[i].addEventListener('load', function() { + this.height = this.contentWindow.document.body.scrollHeight + 25; + }); + } } } diff --git a/Views/FormView.js b/Views/FormView.js index 3a1d2fc..40dd453 100644 --- a/Views/FormView.js +++ b/Views/FormView.js @@ -306,7 +306,7 @@ export class FormView canvas = form.getElementsByTagName('canvas'), external = [].slice.call(document.querySelectorAll(':not(#' + this.id + ') [form=' + this.id + ']')), special = form.querySelectorAll('[data-name]'), - specialExt = document.querySelectorAll('[data-form=' + this.id + '] [data-name]'), + specialExt = document.querySelectorAll(':not(#' + this.id + ') [data-form=' + this.id + ']'), inputLength = inputs.length, externalLength = external.length, specialLength = specialExt.length; @@ -408,6 +408,32 @@ export class FormView for (let j = 0; j < filesLength; ++j) { formData.append(id + j, elements[i].files[j]); } + } else if (elements[i].tagName.toLowerCase() === 'iframe') { + const iframeElements = Array.prototype.slice.call( + elements[i].contentWindow.document.querySelectorAll('[form=' + this.id + ']') + ).concat( + Array.prototype.slice.call( + elements[i].contentWindow.document.querySelectorAll('[data-form=' + this.id + '] [data-name]') + ) + ).filter(function(val) { return val; }); + + const iframeLength = iframeElements.length; + for (let j = 0; j < iframeLength; ++j) { + value = iframeElements[j].value; + + const iframeId = FormView.getElementId(iframeElements[j]); + if (data.hasOwnProperty(iframeId)) { + if (data[iframeId].constructor !== Array) { + data[iframeId] = [data[iframeId]]; + } + + data[iframeId].push(value); + } else { + data[iframeId] = value; + } + } + + continue; } else { if (typeof elements[i].value !== 'undefined') { value = elements[i].value;