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.lampre...@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to