]> git.proxmox.com Git - proxmox-widget-toolkit.git/commit
ComboGrid: fix on-load validation for blank values
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 29 Jan 2020 10:27:18 +0000 (11:27 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 30 Jan 2020 15:14:03 +0000 (16:14 +0100)
commit15206214d94a52317e376ae1798cd71674c5c985
tree9034cef42ac8cf3a23d0ca7ecddbc32dc3561606
parent4e78d7190d9903042bb3dd5f2b4cd04927fa01af
ComboGrid: fix on-load validation for blank values

Commit f32aa3df74 fixed marking multi-select fields with where the store
did not contain a valid value after loading.

However, it introduced a bug for single-select fields where the value
(before the store-load) was explicitly set to be empty (when that should
be invalid because of allowBlank === false).

Fix the logic to correctly detect all scenarios (with def being the
value selected before the store loaded, i.e. undefined or an empty
array):

  !allowBlank &&
    ( def is an array but empty || def is not an array and falsy )

Also use correct error message (localized by ExtJS itself).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
form/ComboGrid.js