diff --git a/Views/FormView.js b/Views/FormView.js index 4291be6..e7da5c5 100644 --- a/Views/FormView.js +++ b/Views/FormView.js @@ -1,14 +1,37 @@ (function (jsOMS, undefined) { - jsOMS.FormView = function (node) { - if (node) { - this.setNode(node); - } + "use strict"; + + jsOMS.FormView = function (element) { + this.id = element.getAttribute('id'); + this.formElement = element; + + this.inputElement = {}; + this.textarea = {}; + this.button = {}; + this.select = {}; }; - jsOMS.FormView.prototype.setNode = function () { - }; + jsOMS.FormView.prototype.bind = function() + { + this.bindInput(); + this.bindTextarea(); + this.bindButton(); + this.bindSelect(); + } - jsOMS.FormView.prototype.submit = function () { + jsOMS.FormView.prototype.bindInput = function() + { + var self = this; - }; + let inputs = this.formElement.getElementsByTagName('input'); + + Object.keys(inputs).forEach(function (key, element) { + self.inputElement[element.getAttribute('id')] = { + id: element.getAttribute('id'), + type: element.getAttribute('type') + }; + }); + } + + jsOMS.FormView.prototype.bind }(window.jsOMS = window.jsOMS || {}));