Skip to contentSkip to conversation

toaster: Disable add layer button when input is empty

PATCH New Belen Barros Pena 1 participant 1 message Oct 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster: Disable add layer button when input is empty

From: Belen Barros Pena <[email protected]>

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]

---
 bitbake/lib/toaster/toastergui/static/js/projectpage.js | 6 ++++++
 1 file changed, 6 insertions(+)
bitbake/lib/toaster/toastergui/static/js/projectpage.js +6 -0
index 30989a0..811aff3 100644
@@ -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;
Signature · 1 line
2.3.8 (Apple Git-58)