[Toaster] [PATCH 2/2] toaster: apply error class to name field
Belen Barros Pena
belen.barros.pena at linux.intel.com
Wed Feb 17 02:54:50 PST 2016
From: Belen Barros Pena <belen.barros.pena at intel.com>
The form for naming new custom images shows you an error message when
the name already exists or you include an invalid character in it. But
when an error appears, the input field was missing the red hihglight.
This patch applies the right class to the form controls whenever an
error message is shown.
Signed-off-by: Belen Barros Pena <belen.barros.pena at intel.com>
---
bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
index 0b9d31a..328997a 100644
--- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
+++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
@@ -36,6 +36,7 @@ function newCustomImageModalInit(){
function showError(text){
invalidNameHelp.text(text);
invalidNameHelp.show();
+ nameInput.parent().addClass('error');
}
nameInput.on('keyup', function(){
@@ -47,9 +48,11 @@ function newCustomImageModalInit(){
if (nameInput.val().search(/[^a-z|0-9|-]/) != -1){
showError(invalidMsg);
newCustomImgBtn.prop("disabled", true);
+ nameInput.parent().addClass('error');
} else {
invalidNameHelp.hide();
newCustomImgBtn.prop("disabled", false);
+ nameInput.parent().removeClass('error');
}
});
}
--
2.5.4 (Apple Git-61)
More information about the toaster
mailing list