From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id C210C1FF0AF for ; Fri, 06 Nov 2026 18:22:59 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7EDB521607; Fri, 06 Nov 2026 18:22:56 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-widget-toolkit v2 04/43] form: date time field: submit combined datetime instead of item fields Date: Fri, 6 Nov 2026 18:21:56 +0100 Message-ID: <20261106172235.890542-5-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261106172235.890542-1-c.ebner@proxmox.com> References: <20261106172235.890542-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793985772936 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.487 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ZT4RVTYJ3ZP3HPA4KHFXNKZANTJOOIRD X-Message-ID-Hash: ZT4RVTYJ3ZP3HPA4KHFXNKZANTJOOIRD X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The field is a plain field container, so forms did not consider it a form field and never submitted its combined datetime value but rather the individual date and time item fields. This was fine for now since the component is currently not used to submit values directly. It is however not intended behaviour and cannot be used as datetime picker in forms. Fix this by using the form field mixin and exclude item fields from being submitted. Also, set the original value after initialization, so that the field is not considered dirty right away and make sure the value is ignored if submitValue is false or the component is disabled. Signed-off-by: Christian Ebner --- src/form/DateTimeField.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/form/DateTimeField.js b/src/form/DateTimeField.js index 096075a..1f1fa7f 100644 --- a/src/form/DateTimeField.js +++ b/src/form/DateTimeField.js @@ -4,7 +4,10 @@ Ext.define('Proxmox.DateTimeField', { alias: ['widget.promxoxDateTimeField'], xtype: 'proxmoxDateTimeField', + mixins: ['Ext.form.field.Field'], + layout: 'hbox', + isFormField: true, viewModel: { data: { @@ -126,6 +129,15 @@ Ext.define('Proxmox.DateTimeField', { return value ? Ext.Date.format(value, me.submitFormat) : null; }, + getSubmitData: function () { + let me = this; + let value = me.getSubmitValue(); + if (me.disabled || !me.submitValue || value === null) { + return null; + } + return { [me.getName()]: value }; + }, + setMinValue: function (value) { this.getViewModel().set('minDatetime', value); }, @@ -148,6 +160,7 @@ Ext.define('Proxmox.DateTimeField', { let vm = me.getViewModel(); vm.set('datetime', me.config.value); + me.resetOriginalValue(); if (me.minValue) { me.setMinValue(me.minValue); @@ -166,6 +179,7 @@ Ext.define('Proxmox.DateTimeField', { items: [ { xtype: 'datefield', + submitValue: false, editable: false, flex: 1, format: 'Y-m-d', @@ -177,6 +191,7 @@ Ext.define('Proxmox.DateTimeField', { }, { xtype: 'timefield', + submitValue: false, format: 'H:i', width: 80, value: '00:00', -- 2.47.3