From 6f647c1a9db7e88e33441caa97742ee6d039bb18 Mon Sep 17 00:00:00 2001 From: James Lucas Date: Fri, 28 Jul 2023 13:06:42 +1000 Subject: [PATCH] Use the created element when setting userData value --- src/js/control/hidden.js | 5 +++-- src/js/control/textarea.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/control/hidden.js b/src/js/control/hidden.js index d43805626..d013ae325 100644 --- a/src/js/control/hidden.js +++ b/src/js/control/hidden.js @@ -10,8 +10,9 @@ export default class controlHidden extends control { * @return {Object} DOM Element to be injected into the form. */ build() { + this.field = this.markup('input', null, this.config) return { - field: this.markup('input', null, this.config), + field: this.field, layout: 'hidden', } } @@ -22,7 +23,7 @@ export default class controlHidden extends control { onRender() { // Set userData if available if (this.config.userData) { - $('#' + this.config.name).val(this.config.userData[0]) + $(this.field).val(this.config.userData[0]) } } } diff --git a/src/js/control/textarea.js b/src/js/control/textarea.js index db37ccce9..98c009296 100644 --- a/src/js/control/textarea.js +++ b/src/js/control/textarea.js @@ -35,7 +35,7 @@ export default class controlTextarea extends control { onRender() { // Set userData if available if (this.config.userData) { - $('#' + this.config.name).val(this.config.userData[0]) + $(this.field).val(this.config.userData[0]) } }