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>
function showError(text){
invalidNameHelp.text(text);
invalidNameHelp.show();
+ nameInput.parent().addClass('error');
}
nameInput.on('keyup', function(){
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');
}
});
}