From 7c95f79bfce6a49de7d7c89bdcd1577e24977260 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Wed, 4 Jan 2023 15:02:10 -0500 Subject: [PATCH] interface.js: allow specifying default value for form elements --- scripts/interface.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/interface.js b/scripts/interface.js index bc678d6..23e3cff 100644 --- a/scripts/interface.js +++ b/scripts/interface.js @@ -218,7 +218,7 @@ function bufToB64 (buf) { } class FormElement extends InterfaceElement { - constructor({tag, labelTag, label="", fragment, dataType, advanced=false, enabled=true, enabledFunc}) { + constructor({tag, labelTag, label="", value, fragment, dataType, advanced=false, enabled=true, enabledFunc}) { super({fragment, enabled, enabledFunc}); this.labelText = label; @@ -238,6 +238,8 @@ class FormElement extends InterfaceElement { this.advanced = advanced; if (this.advanced === true) this.hidden = true; + + if (value !== undefined) this.value = value; } get value() {