[pve-devel] [PATCH v2 manager] gui: reset cdimage selector on change

Tim Marx t.marx at proxmox.com
Fri Oct 25 12:47:33 CEST 2019


to improve UX, disabled child fields shouldn't show validation errors
when the parent widget (radiofield) isn't selected anymore.

Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
changes v2:
* swapped ternary for if/else
* make use of new cdImageField var
* adapted commit message

 www/manager6/qemu/CDEdit.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index 78d758c7..720ddde2 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -88,8 +88,13 @@ Ext.define('PVE.qemu.CDInputPanel', {
 			return;
 		    }
 		    me.down('field[name=cdstorage]').setDisabled(!value);
-		    me.down('field[name=cdimage]').setDisabled(!value);
-		    me.down('field[name=cdimage]').validate();
+		    var cdImageField = me.down('field[name=cdimage]');
+		    cdImageField.setDisabled(!value);
+		    if(value) {
+			cdImageField.validate();
+		    } else {
+			cdImageField.reset();
+		    }
 		}
 	    }
 	});
--
2.20.1




More information about the pve-devel mailing list