Bug 25727: Fix highlight of a missing field

In the previous version of Select2 we had only 1 'a' tag that was
visible, next to the invisible select.

Now we have a 3 nested span elt, the last one (with a role=combobox
attribute) is the one we want to style.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-06-13 15:03:50 +02:00
parent 529182aaf3
commit 424187b18a
3 changed files with 17 additions and 4 deletions

View file

@ -1552,11 +1552,11 @@ input[type='text']:read-only:focus {
}
.subfield_not_filled {
background-color: #FFFF99;
background-color: #FFFF99 !important;
}
.important_subfield_not_filled {
background-color : #FFFFCC;
background-color : #FFFFCC !important;
}
.content_hidden {

View file

@ -80,7 +80,14 @@ function AreMandatoriesNotOk(){
var id_string = mandatories[i];
// alert (id_string);
if( ! $("#" + id_string).val() ){
$("#" + id_string).attr('class','subfield_not_filled').focus();
var elt = document.getElementById(id_string);
if ( elt.nodeName == 'SELECT' ) {
$(elt).siblings('.select2').find("span[role='combobox']").addClass('subfield_not_filled');
} else {
$(elt).addClass('subfield_not_filled');
}
$(elt).focus();
StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
}
}

View file

@ -334,7 +334,13 @@
}
if( tabflag[tag+subfield+tagnumber][0] != 1 && (document.getElementById(subfields[i]) != null && ! document.getElementById(subfields[i]).value || document.getElementById(subfields[i]) == null)){
tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
document.getElementById(subfields[i]).setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass);
var elt = document.getElementById(subfields[i]);
if ( elt.nodeName == 'SELECT' ) {
$(elt).siblings('.select2').find("span[role='combobox']").addClass(notFilledClass);
} else {
elt.setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass);
}
$('#' + subfields[i]).focus();
tabflag[tag+subfield+tagnumber][1]=label[i];
tabflag[tag+subfield+tagnumber][2]=tab[i];