[PATCH] Bug Fix: Correct select menu to handle empty input

From: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com> Signed-off-by: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com> --- ui/js/widgets/select-menu.js | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/js/widgets/select-menu.js b/ui/js/widgets/select-menu.js index ad53200..c4b0209 100644 --- a/ui/js/widgets/select-menu.js +++ b/ui/js/widgets/select-menu.js @@ -36,8 +36,10 @@ var selectedClass = 'active'; var itemTag = 'li'; var item; + that.listControl.find('li').remove(); + that.label.text(""); + that.target.val(""); if (options.length > 0) { - that.listControl.find('li').remove(); $.each(options, function(index, option) { item = $('<' + itemTag + '>' + option.label +'</' + itemTag + '>'); item.data('value', option.value); @@ -58,8 +60,6 @@ that.target.change(); } }); - } else { - kimchi.message.error.code('KCHAPI6006E'); } }, -- 1.7.1

This is the same patch as my 1st "[PATCH] Bug 440 Fix", but I changed the title. No matter finally how 440 will be resolved, part of that issue is pure from select menu widget which handles empty option incorrectly. There are many places using select widget which will all suffer from this issue, so it worth a separate fix. On 9/23/2014 6:48 PM, huoyuxin@linux.vnet.ibm.com wrote:
From: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com> --- ui/js/widgets/select-menu.js | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ui/js/widgets/select-menu.js b/ui/js/widgets/select-menu.js index ad53200..c4b0209 100644 --- a/ui/js/widgets/select-menu.js +++ b/ui/js/widgets/select-menu.js @@ -36,8 +36,10 @@ var selectedClass = 'active'; var itemTag = 'li'; var item; + that.listControl.find('li').remove(); + that.label.text(""); + that.target.val(""); if (options.length > 0) { - that.listControl.find('li').remove(); $.each(options, function(index, option) { item = $('<' + itemTag + '>' + option.label +'</' + itemTag + '>'); item.data('value', option.value); @@ -58,8 +60,6 @@ that.target.change(); } }); - } else { - kimchi.message.error.code('KCHAPI6006E'); } },

On 09/23/2014 07:48 AM, huoyuxin@linux.vnet.ibm.com wrote:
From: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com> --- ui/js/widgets/select-menu.js | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ui/js/widgets/select-menu.js b/ui/js/widgets/select-menu.js index ad53200..c4b0209 100644 --- a/ui/js/widgets/select-menu.js +++ b/ui/js/widgets/select-menu.js @@ -36,8 +36,10 @@ var selectedClass = 'active'; var itemTag = 'li'; var item; + that.listControl.find('li').remove(); + that.label.text(""); + that.target.val(""); if (options.length > 0) { - that.listControl.find('li').remove(); $.each(options, function(index, option) { item = $('<' + itemTag + '>' + option.label +'</' + itemTag + '>'); item.data('value', option.value); @@ -58,8 +60,6 @@ that.target.change(); } });
- } else { - kimchi.message.error.code('KCHAPI6006E');
As this message will not be used we can remove it from i18n.tmpl.html
} },
participants (3)
-
Aline Manera
-
huoyuxin@linux.vnet.ibm.com
-
Yu Xin Huo