1 jQuery.validator.addMethod( "restrictionCode", function(value){
2 var ex = Object.keys(existing);
3 return (value.length > 0 && ex.indexOf(value.toUpperCase()) > -1) ?
6 }, MSG_DUPLICATE_CODE);
8 jQuery.validator.addMethod( "restrictionDisplayText", function(value){
9 var ex = Object.values(existing).map(function(el) {
10 return el.toLowerCase();
12 var code = $('input[name="code"]').val();
13 return (value.length > 0 && ex.indexOf(value.toLowerCase()) > -1) && existing[code] != value ?
16 }, MSG_DUPLICATE_DISPLAY_TEXT);
18 $(document).ready(function() {
19 KohaTable("restriction_types", {
31 "sPaginationType": "full",
32 "exportColumns": [0,1],
35 $("#restriction_form").validate({
43 restrictionDisplayText: true
48 restrictionCode: MSG_DUPLICATE_CODE
51 restrictionDisplayText: MSG_DUPLICATE_DISPLAY_TEXT