summaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui
diff options
context:
space:
mode:
authorBelen Barros Pena <belen.barros.pena@intel.com>2016-02-22 09:08:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-26 17:17:24 +0000
commitdf342e7662179410467c47cd870180ea75f863d4 (patch)
tree42ded2dc3458692c7d4ad21b7de3f7af8c51ebdf /lib/toaster/toastergui
parent9df802182b0b96295b148a1681c2265e72d8306b (diff)
downloadbitbake-df342e7662179410467c47cd870180ea75f863d4.tar.gz
toaster: apply error class to name field
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 highlight. 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@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/toastergui')
-rw-r--r--lib/toaster/toastergui/static/js/newcustomimage_modal.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/toaster/toastergui/static/js/newcustomimage_modal.js b/lib/toaster/toastergui/static/js/newcustomimage_modal.js
index 0b9d31aa6..328997af3 100644
--- a/lib/toaster/toastergui/static/js/newcustomimage_modal.js
+++ b/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');
}
});
}