Tested this patch and got issues below:
1. Once I input the storage pool name, an error message occurs which
looks like some request is sent.
2. The button is enabled only when the 'Storage Path' field lose focus.
it should bind to 'keyup' event to make the button enabled once
there is a valid input and disabled once user clear the path.
On 5/14/2014 11:38 AM, shaohef(a)linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
All button status of add/create pages should be consistent - it should
be disabled by default until the minimum of the required fields are
filled.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.storagepool_add_main.js | 8 ++++++++
ui/pages/storagepool-add.html.tmpl | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.storagepool_add_main.js
b/ui/js/src/kimchi.storagepool_add_main.js
index 86dbe7f..7bed152 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -145,6 +145,14 @@ kimchi.initStorageAddPage = function() {
$('#iscsiportId').keyup(function(event) {
$(this).toggleClass("invalid-field",!/^[0-9]+$/.test($(this).val()));
});
+ $('#form-pool-add').change(function() {
+ if (kimchi.validateForm()) {
+ $('#pool-doAdd').removeAttr('disabled');
+ } else {
+ $('#pool-doAdd').attr('disabled', 'disabled');
+ }
+
+ });
};
kimchi.validateForm = function() {
diff --git a/ui/pages/storagepool-add.html.tmpl b/ui/pages/storagepool-add.html.tmpl
index 977db66..7406bab 100644
--- a/ui/pages/storagepool-add.html.tmpl
+++ b/ui/pages/storagepool-add.html.tmpl
@@ -152,7 +152,7 @@
</div>
<footer>
<div class="btn-group">
- <button id="pool-doAdd" class="btn-normal">
+ <button id="pool-doAdd" class="btn-normal"
disabled="disabled">
<span
class="text">$_("Create")</span>
</button>
</div>