View | Details | Raw Unified | Return to bug 41060
Collapse All | Expand All

(-)a/cataloguing/value_builder/validate_isbn.pl (-4 / +10 lines)
Lines 30-49 my $builder = sub { Link Here
30
30
31
    return qq|
31
    return qq|
32
<script>
32
<script>
33
function Blur$id(event) {
33
function Change$id(event) {
34
    field = \$('#'+event.data.id);
34
    field = \$('#'+event.data.id);
35
    isbn = field.val();
35
    isbn = field.val();
36
    var url = '../cataloguing/plugin_launcher.pl?plugin_name=validate_isbn.pl&isbn=' + isbn;
36
    var url = '../cataloguing/plugin_launcher.pl?plugin_name=validate_isbn.pl&isbn=' + isbn;
37
    var req = \$.get(url);
37
    var req = \$.get(url);
38
    req.done(function(resp){
38
    req.done(function(resp){
39
        if ( resp != 1 ) {
39
        field.addClass("checked_isbn");
40
        if ( resp == 1 ) field.removeClass("subfield_not_filled");
41
        else {
40
           field.addClass("subfield_not_filled");
42
           field.addClass("subfield_not_filled");
43
           field.focus();
41
           alert("Invalid ISBN : " + isbn);
44
           alert("Invalid ISBN : " + isbn);
42
           return;
43
        }
45
        }
44
        field.removeClass("subfield_not_filled");
45
    });
46
    });
46
}
47
}
48
function Blur$id(event) {
49
    field = \$('#'+event.data.id);
50
    // when not yet checked (in existing record), trigger change event
51
    if ( !field.hasClass("checked_isbn") ) field.trigger("change");
52
}
47
</script>|;
53
</script>|;
48
};
54
};
49
55
(-)a/cataloguing/value_builder/validate_issn.pl (-5 / +10 lines)
Lines 30-49 my $builder = sub { Link Here
30
30
31
    return qq|
31
    return qq|
32
<script>
32
<script>
33
function Blur$id(event) {
33
function Change$id(event) {
34
    field = \$('#'+event.data.id);
34
    field = \$('#'+event.data.id);
35
    issn = field.val();
35
    issn = field.val();
36
    var url = '../cataloguing/plugin_launcher.pl?plugin_name=validate_issn.pl&issn=' + issn;
36
    var url = '../cataloguing/plugin_launcher.pl?plugin_name=validate_issn.pl&issn=' + issn;
37
    var req = \$.get(url);
37
    var req = \$.get(url);
38
    req.done(function(resp){
38
    req.done(function(resp){
39
        if ( resp != 1 ) {
39
        field.addClass("checked_issn");
40
        if ( resp == 1 ) field.removeClass("subfield_not_filled");
41
        else {
40
           field.addClass("subfield_not_filled");
42
           field.addClass("subfield_not_filled");
43
           field.focus();
41
           alert("Invalid ISSN : " + issn);
44
           alert("Invalid ISSN : " + issn);
42
           return;
43
        }
45
        }
44
        field.removeClass("subfield_not_filled");
45
    });
46
    });
46
}
47
}
48
function Blur$id(event) {
49
    field = \$('#'+event.data.id);
50
    // when not yet checked (in existing record), trigger change event
51
    if ( !field.hasClass("checked_issn") ) field.trigger("change");
52
}
47
</script>|;
53
</script>|;
48
};
54
};
49
55
50
- 

Return to bug 41060