CC-4485: Library -> Advanced Search -> Tooltip needed for invalid input

-done
This commit is contained in:
denise 2012-09-19 15:35:45 -04:00
parent dc4e12a0ae
commit 4b2d6caf0e
1 changed files with 15 additions and 4 deletions

View File

@ -1089,7 +1089,7 @@ function validateAdvancedSearch(divs) {
if (!valid) allValid = false; if (!valid) allValid = false;
} }
addRemoveValidationIcons(valid, $(field)); addRemoveValidationIcons(valid, $(field), searchTermType);
/* Empty fields should not have valid/invalid indicator /* Empty fields should not have valid/invalid indicator
* Range values are considered valid even if only the * Range values are considered valid even if only the
@ -1114,9 +1114,20 @@ function validateAdvancedSearch(divs) {
return allValid; return allValid;
} }
function addRemoveValidationIcons(valid, field) { function addRemoveValidationIcons(valid, field, searchTermType) {
var validIndicator = "<span class='checked-icon sp-checked-icon'></span>", var title = '';
invalidIndicator = "<span class='not-available-icon sp-checked-icon'></span>"; if (searchTermType === 'i') {
title = 'Input must be a positive number';
} else if (searchTermType === 'n') {
title = 'Input must be a number';
} else if (searchTermType === 't') {
title = 'Input must be in the format: yyyy-mm-dd';
} else if (searchTermType === 'l') {
title = 'Input must be in the format: hh:mm:ss.t';
}
var validIndicator = " <span class='checked-icon sp-checked-icon'></span>",
invalidIndicator = " <span title='"+title+"' class='not-available-icon sp-checked-icon'></span>";
if (valid) { if (valid) {
if (!field.closest('div').children(':last-child').hasClass('checked-icon')) { if (!field.closest('div').children(':last-child').hasClass('checked-icon')) {