Skip to content
Snippets Groups Projects
Commit a80b3c37 authored by bbaer's avatar bbaer
Browse files

handle submit save submit

parent e1f82085
No related branches found
No related tags found
No related merge requests found
Pipeline #744 failed
......@@ -60,6 +60,8 @@ var QfqNS = QfqNS || {};
var element = data.elements[i];
var $element = new n.ElementBuilder(element);
this._$container.append($element.display());
var that = this;
$element.on('form.submit', function() { that.toggleDroplets(); });
}
};
......
......@@ -17,9 +17,9 @@ var QfqNS = QfqNS || {};
'use strict';
n.ElementBuilder = function(obj, parent) {
this.type = obj.type;
this.type = obj.type;
this.class = obj.class || false;
this.text = obj.text || false;
this.text = obj.text || false;
this.tooltip = obj.tooltip || false;
this.label = obj.label || false;
this.value = obj.value || false;
......@@ -29,6 +29,8 @@ var QfqNS = QfqNS || {};
this.parent = parent || false;
this.$element = {};
this.children = [];
this.eventEmitter = new EventEmitter();
if (obj.children) {
for (var i = 0; i < obj.children.length; i++) {
......@@ -41,8 +43,11 @@ var QfqNS = QfqNS || {};
this.children.push(element);
}
}
};
n.ElementBuilder.prototype.on = n.EventEmitter.onMixin;
n.ElementBuilder.prototype.display = function() {
var $element = {};
......@@ -56,17 +61,9 @@ var QfqNS = QfqNS || {};
this.$form = $element;
}
if (this.type === "row") {
$element = this._buildRow();
}
if (this.type === "checkbox") {
$element = this._buildInput();
}
if (this.type === "label") {
$element = this._buildLabel();
}
if (this.type === "row") $element = this._buildRow();
if (this.type === "checkbox") $element = this._buildInput();
if (this.type === "label") $element = this._buildLabel();
if (this.children) {
for (var i = 0; i < this.children.length; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment