diff --git a/dist/js/brutusin-json-forms.js b/dist/js/brutusin-json-forms.js
index cbecd7d..7d2a4f6 100644
--- a/dist/js/brutusin-json-forms.js
+++ b/dist/js/brutusin-json-forms.js
@@ -827,8 +827,8 @@ if (typeof brutusin === "undefined") {
obj.getData = function () {
function removeEmptiesAndNulls(object, s) {
- if (ss === null) {
- ss = SCHEMA_ANY;
+ if (!s) { // 03_AddLevel2Item_SelectOPTION-2.png
+ s = SCHEMA_ANY; // 03_AddLevel2Item_SelectOPTION-2.png
}
if (s.$ref) {
s = getDefinition(s.$ref);
@@ -1307,7 +1307,7 @@ if (typeof brutusin === "undefined") {
function cleanSchemaMap(schemaId) {
for (var prop in schemaMap) {
- if (schemaId.startsWith(prop)) {
+ if (prop.startsWith(schemaId)) { // 02_AddLevel1Item_Delete_AgainAdd.png
delete schemaMap[prop];
}
}
@@ -1409,7 +1409,7 @@ if (typeof brutusin === "undefined") {
throw ("Node '" + name + "' is of type array");
}
var element = currentToken.substring(1, currentToken.length - 1);
- if (element.equals("#")) {
+ if (element === "#") { // 01_elementEquals.png
for (var i = 0; i < data.length; i++) {
var child = data[i];
visit(name + currentToken, queue.slice(0), child, data, i);
diff --git a/examples/example1.html b/examples/example1.html
new file mode 100644
index 0000000..d67887b
--- /dev/null
+++ b/examples/example1.html
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/example2.html b/examples/example2.html
new file mode 100644
index 0000000..b332c4c
--- /dev/null
+++ b/examples/example2.html
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/js/brutusin-json-forms.js b/src/js/brutusin-json-forms.js
index 49ee5ea..845adfb 100644
--- a/src/js/brutusin-json-forms.js
+++ b/src/js/brutusin-json-forms.js
@@ -177,6 +177,7 @@ if (typeof brutusin === "undefined") {
} else if (s.media) {
input = document.createElement("input");
input.type = "file";
+ appendChild(input, option, s);
// XXX TODO, encode the SOB properly.
} else if (s.enum) {
input = document.createElement("select");
@@ -204,7 +205,7 @@ if (typeof brutusin === "undefined") {
}
}
if (s.enum.length === 1)
- input.selectedIndex = 0;
+ input.selectedIndex = 1;
else
input.selectedIndex = selectedIndex;
} else {
@@ -222,10 +223,6 @@ if (typeof brutusin === "undefined") {
// #46, problem in IE11. TODO polyfill?
input.type = "text";
}
- } else if (s.format === "date") {
- input.type = "date";
- } else if (s.format === "time") {
- input.type = "time";
} else if (s.format === "email") {
input.type = "email";
} else if (s.format === "text") {
@@ -349,7 +346,7 @@ if (typeof brutusin === "undefined") {
input = document.createElement("input");
input.type = "checkbox";
if (value === true || value !== false && s.default) {
- input.checked = true;
+ input.checked = true;
}
} else {
input = document.createElement("select");
@@ -750,7 +747,6 @@ if (typeof brutusin === "undefined") {
if (s.readOnly)
addButton.disabled = true;
addButton.setAttribute('type', 'button');
- addButton.className = "addItem";
addButton.getValidationError = function () {
if (s.minItems && s.minItems > table.rows.length) {
return BrutusinForms.messages["minItems"].format(s.minItems);
@@ -831,7 +827,7 @@ if (typeof brutusin === "undefined") {
obj.getData = function () {
function removeEmptiesAndNulls(object, s) {
- if (s === null) {
+ if (!s) {
s = SCHEMA_ANY;
}
if (s.$ref) {
@@ -1311,7 +1307,7 @@ if (typeof brutusin === "undefined") {
function cleanSchemaMap(schemaId) {
for (var prop in schemaMap) {
- if (prop.startsWith(schemaId)) {
+ if (prop.startsWith(schemaId)) { // 02_AddLevel1Item_Delete_AgainAdd.png
delete schemaMap[prop];
}
}
@@ -1413,7 +1409,7 @@ if (typeof brutusin === "undefined") {
throw ("Node '" + name + "' is of type array");
}
var element = currentToken.substring(1, currentToken.length - 1);
- if (element.equals("#")) {
+ if (element === "#") {
for (var i = 0; i < data.length; i++) {
var child = data[i];
visit(name + currentToken, queue.slice(0), child, data, i);