From 5d7d30de0fae9c723b27f50600d6bb86b88a762a Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 24 Oct 2023 13:58:04 +0200 Subject: [PATCH] text field: add trimValue config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inspired by a recent bug detected in the subscription key field, where a trailing white space caused verification issues. We might even enable the trimming by default, after checking call sites that is – most often one wants to trim the text to be submitted Signed-off-by: Thomas Lamprecht --- src/form/TextField.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/form/TextField.js b/src/form/TextField.js index 56e5976..7ee95c4 100644 --- a/src/form/TextField.js +++ b/src/form/TextField.js @@ -6,6 +6,8 @@ Ext.define('Proxmox.form.field.Textfield', { skipEmptyText: true, deleteEmpty: false, + + trimValue: false, }, getSubmitData: function() { @@ -29,6 +31,9 @@ Ext.define('Proxmox.form.field.Textfield', { let me = this; let value = this.processRawValue(this.getRawValue()); + if (me.getTrimValue() && typeof value === 'string') { + value = value.trim(); + } if (value !== '') { return value; }