From 4649cf1670dda86248cabfc68931f90232d9f361 Mon Sep 17 00:00:00 2001 From: "James Cullum (Pseudonym)" Date: Tue, 13 Mar 2018 16:08:14 +0100 Subject: [PATCH 1/3] Remove unnecessary eval See issue #121 --- src/js/brutusin-json-forms.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/js/brutusin-json-forms.js b/src/js/brutusin-json-forms.js index 49ee5ea..81b8934 100644 --- a/src/js/brutusin-json-forms.js +++ b/src/js/brutusin-json-forms.js @@ -1241,13 +1241,7 @@ if (typeof brutusin === "undefined") { } function getInitialValue(id) { - var ret; - try { - eval("ret = initialValue" + id.substring(1)); - } catch (e) { - ret = null; - } - return ret; + return initialValue; } function getValue(schema, input) { From 1de9ba0e8273f1043ca7fcc0d939981dfc676f5d Mon Sep 17 00:00:00 2001 From: "James Cullum (Pseudonym)" Date: Wed, 21 Mar 2018 09:38:48 +0100 Subject: [PATCH 2/3] Update brutusin-json-forms.js Old one added wrong text to new elements being added. Should behave completely like the old code now. --- src/js/brutusin-json-forms.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/brutusin-json-forms.js b/src/js/brutusin-json-forms.js index 81b8934..fc65836 100644 --- a/src/js/brutusin-json-forms.js +++ b/src/js/brutusin-json-forms.js @@ -1241,7 +1241,11 @@ if (typeof brutusin === "undefined") { } function getInitialValue(id) { - return initialValue; + if(id.substring(1).length) { + return null; + } else { + return initialValue; + } } function getValue(schema, input) { From 3eabd4d75337871ff2bfb39f9a5ce0ccb2568120 Mon Sep 17 00:00:00 2001 From: "James Cullum (Pseudonym)" Date: Wed, 21 Mar 2018 09:39:50 +0100 Subject: [PATCH 3/3] Tabs -> spaces --- src/js/brutusin-json-forms.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/brutusin-json-forms.js b/src/js/brutusin-json-forms.js index fc65836..2a9ea35 100644 --- a/src/js/brutusin-json-forms.js +++ b/src/js/brutusin-json-forms.js @@ -1242,10 +1242,10 @@ if (typeof brutusin === "undefined") { function getInitialValue(id) { if(id.substring(1).length) { - return null; - } else { - return initialValue; - } + return null; + } else { + return initialValue; + } } function getValue(schema, input) {