From d4820f16c76398400ddd573db03c654c51d40c1b Mon Sep 17 00:00:00 2001 From: Belen Barros Pena Date: Wed, 14 Oct 2015 13:43:18 +0100 Subject: [PATCH] toaster: Disable add layer button when input is empty The 'add layer' button in the project configuration page is enabled when you select a layer from the type ahead. However, if you delete the layer name, the 'add layer' button remains enabled, and if you click it, the last selected layer from the type ahead will be added to the project. It is probably better to disable the 'add layer' button when the input field is empty. [YOCTO #8449] Signed-off-by: Belen Barros Pena Signed-off-by: Elliot Smith Signed-off-by: Richard Purdie --- lib/toaster/toastergui/static/js/projectpage.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/toaster/toastergui/static/js/projectpage.js b/lib/toaster/toastergui/static/js/projectpage.js index 30989a016c8..b0fe4510a96 100644 --- a/lib/toaster/toastergui/static/js/projectpage.js +++ b/lib/toaster/toastergui/static/js/projectpage.js @@ -103,6 +103,12 @@ function projectPageInit(ctx) { layerAddBtn.removeAttr("disabled"); }); + layerAddInput.keyup(function() { + if ($(this).val().length == 0) { + layerAddBtn.attr("disabled", "disabled") + } + }); + layerAddBtn.click(function(e){ e.preventDefault(); var layerObj = currentLayerAddSelection; -- 2.47.3