Bug 41060: (QA follow-up) Check in change, trigger once in Blur
If we already checked and nothing changes, no need to check again. Set focus to field if we warn. For consistency copied these changes to validate_isbn. Test plan: Try various valid and invalid ISSNs. Tab through the field repeatedly; you should only have a warning once, if the ISSN is invalid (yellow colored). Save a bad ISSN into a record. Open it again and tab through ISSN; you should be warned. Repeat similarly for ISBN field. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
c3e8b34e6a
commit
76a1dc2dd6
|
|
@ -30,20 +30,26 @@ my $builder = sub {
|
|||
|
||||
return qq|
|
||||
<script>
|
||||
function Blur$id(event) {
|
||||
function Change$id(event) {
|
||||
field = \$('#'+event.data.id);
|
||||
isbn = field.val();
|
||||
var url = '../cataloguing/plugin_launcher.pl?plugin_name=validate_isbn.pl&isbn=' + isbn;
|
||||
var req = \$.get(url);
|
||||
req.done(function(resp){
|
||||
if ( resp != 1 ) {
|
||||
field.addClass("checked_isbn");
|
||||
if ( resp == 1 ) field.removeClass("subfield_not_filled");
|
||||
else {
|
||||
field.addClass("subfield_not_filled");
|
||||
field.focus();
|
||||
alert("Invalid ISBN : " + isbn);
|
||||
return;
|
||||
}
|
||||
field.removeClass("subfield_not_filled");
|
||||
});
|
||||
}
|
||||
function Blur$id(event) {
|
||||
field = \$('#'+event.data.id);
|
||||
// when not yet checked (in existing record), trigger change event
|
||||
if ( !field.hasClass("checked_isbn") ) field.trigger("change");
|
||||
}
|
||||
</script>|;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -30,20 +30,26 @@ my $builder = sub {
|
|||
|
||||
return qq|
|
||||
<script>
|
||||
function Blur$id(event) {
|
||||
function Change$id(event) {
|
||||
field = \$('#'+event.data.id);
|
||||
issn = field.val();
|
||||
var url = '../cataloguing/plugin_launcher.pl?plugin_name=validate_issn.pl&issn=' + issn;
|
||||
var req = \$.get(url);
|
||||
req.done(function(resp){
|
||||
if ( resp != 1 ) {
|
||||
field.addClass("checked_issn");
|
||||
if ( resp == 1 ) field.removeClass("subfield_not_filled");
|
||||
else {
|
||||
field.addClass("subfield_not_filled");
|
||||
field.focus();
|
||||
alert("Invalid ISSN : " + issn);
|
||||
return;
|
||||
}
|
||||
field.removeClass("subfield_not_filled");
|
||||
});
|
||||
}
|
||||
function Blur$id(event) {
|
||||
field = \$('#'+event.data.id);
|
||||
// when not yet checked (in existing record), trigger change event
|
||||
if ( !field.hasClass("checked_issn") ) field.trigger("change");
|
||||
}
|
||||
</script>|;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue