1 jQuery.validator.addMethod( "letters_numbers", function(value,element){
2 var patt = /^[a-zA-Z0-9\-_]+$/g;
3 if (patt.test(element.value)) {
8 }, MSG_CATEGORYCODE_CHARS
11 jQuery.validator.addMethod( "enrollment_period", function(){
12 enrolmentperiod = $("#enrolmentperiod").val();
13 enrolmentperioddate = $("#enrolmentperioddate").val();
14 if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) {
19 }, MSG_ONE_ENROLLMENTPERIOD
23 $(document).ready(function() {
24 KohaTable("patron_categories", {
30 "aTargets": [3, 4, 5],
36 "sPaginationType": "full",
37 "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12],
40 $("#enrolmentperioddate").datepicker({
42 }); // Require that "until date" be in the future
44 if ($("#branches option:selected").length < 1) {
45 $("#branches option:first").attr("selected", "selected");
48 $("#categorycode").on("blur",function(){
52 $("#category_form").validate({
58 description: "required",
60 required: function(element){
61 return $("#enrolmentperioddate").val() === "";
64 enrollment_period: true,
67 enrolmentperioddate: {
68 required: function(element){
69 return $("#enrolmentperiod").val() === "";
71 enrollment_period: true
73 dateofbirthrequired: {
91 required: MSG_ONE_ENROLLMENTPERIOD
93 enrolmentperioddate: {
94 required: MSG_ONE_ENROLLMENTPERIOD