[pve-devel] applied: [PATCH widget-toolkit] ComboGrid: fix validation for !allowBlank disabled fields

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Feb 5 08:43:45 CET 2020


Am 2/3/20 um 3:14 PM schrieb Stefan Reiter:
> Used in "Add USB to VM" dialog for example.
> 
> This was broken before 15206214d9 "ComboGrid: fix on-load validation for blank
> values" (only the one you enabled first was validated, the other always showed
> as valid), and afterwards too, but in a different way (both are now immediately
> marked invalid until you select and unselect them) - which is how I noticed.
> 
> With this the validation now works correctly.
> 
> Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> ---
> 
> Before my last patch they didn't validate enough, now they validate too much...
> I tried my best to test all of our ComboGrids once again, hope I didn't miss
> anything this time.
> 

applied, thanks & I hope too ;)

>  form/ComboGrid.js | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/form/ComboGrid.js b/form/ComboGrid.js
> index 54bc239..9bdf721 100644
> --- a/form/ComboGrid.js
> +++ b/form/ComboGrid.js
> @@ -378,6 +378,13 @@ Ext.define('Proxmox.form.ComboGrid', {
>  	return true;
>      },
>  
> +    // validate after enabling a field, otherwise blank fields with !allowBlank
> +    // are sometimes not marked as invalid
> +    setDisabled: function(value) {
> +	this.callParent([value]);
> +	this.validate();
> +    },
> +
>      initComponent: function() {
>  	var me = this;
>  
> @@ -461,7 +468,7 @@ Ext.define('Proxmox.form.ComboGrid', {
>  			me.setValue(def, true);
>  		    } else if (!me.allowBlank && !(Ext.isArray(def) ? def.length : def)) {
>  			me.setValue(def);
> -			if (!me.notFoundIsValid) {
> +			if (!me.notFoundIsValid && !me.isDisabled()) {
>  			    me.markInvalid(me.blankText);
>  			}
>  		    }
> 





More information about the pve-devel mailing list