all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] applied: [PATCH widget-toolkit] text field: add trimValue config
Date: Tue, 24 Oct 2023 14:02:12 +0200	[thread overview]
Message-ID: <20231024120212.1860444-1-t.lamprecht@proxmox.com> (raw)

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





                 reply	other threads:[~2023-10-24 12:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231024120212.1860444-1-t.lamprecht@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal