public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] applied: [PATCH widget-toolkit] text field: add trimValue config
@ 2023-10-24 12:02 Thomas Lamprecht
  0 siblings, 0 replies; only message in thread
From: Thomas Lamprecht @ 2023-10-24 12:02 UTC (permalink / raw)
  To: pve-devel

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 <t.lamprecht@proxmox.com>
---

had that laying around since a while and figured why not, it's opt-in
for now anyway.

 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;
 	}
-- 
2.39.2





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-24 12:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-24 12:02 [pve-devel] applied: [PATCH widget-toolkit] text field: add trimValue config Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal