aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/webui/static/js/configs.js
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-13 17:18:51 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-13 17:18:51 +0800
commit013c815abfa4fd0391b79b2653d989588b170e86 (patch)
tree64d3845363fc58255d9845cbd2fd07607fd1b461 /fg21sim/webui/static/js/configs.js
parent81434114e4d03cce101d3a732795afa4835fe7c8 (diff)
downloadfg21sim-013c815abfa4fd0391b79b2653d989588b170e86.tar.bz2
webui: Show a modal box indicating there are invalid configs
Diffstat (limited to 'fg21sim/webui/static/js/configs.js')
-rw-r--r--fg21sim/webui/static/js/configs.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js
index 4e635ae..6ded8c4 100644
--- a/fg21sim/webui/static/js/configs.js
+++ b/fg21sim/webui/static/js/configs.js
@@ -136,7 +136,7 @@ var getFormConfigSingle = function (name) {
value = target.filter(":checked").val();
} else if (target.is(":checkbox") && target.data("type") === "boolean") {
// Convert the checkbox value into boolean
- value = target.is(":checked") ? true : false;
+ value = target.prop("checked");
} else if (target.is(":checkbox")) {
// Get values of checked checkboxes into array
// Credit: https://stackoverflow.com/a/16171146/4856091
@@ -211,13 +211,10 @@ var setFormConfigSingle = function (name, value) {
// Convert the checkbox value into boolean
target.prop("checked", value);
} else if (target.is(":checkbox")) {
- // Convert value (key of a single option) to an Array
- if (! Array.isArray(value)) {
- value = [value];
- }
+ // The received value is already an Array
target.val(value);
} else if (target.is(":text") && target.data("type") == "array") {
- // The received value is already an Array
+ // Convert array of values into a string
value = value.join(", ");
target.val(value);
} else {