3 jQuery.validator.addMethod( "letters_numbers", function(value,element){
4 var patt = /^[a-zA-Z0-9\-_]+$/g;
5 if (patt.test(element.value)) {
10 }, __("Category code can only contain the following characters: letters, numbers, - and _.")
13 jQuery.validator.addMethod( "enrollment_period", function(){
14 enrolmentperiod = $("#enrolmentperiod").val();
15 enrolmentperioddate = $("#enrolmentperioddate").val();
16 if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) {
21 }, __("Please choose an enrollment period in months OR by date.")
25 $(document).ready(function() {
26 KohaTable("patron_categories", {
32 "aTargets": [3, 4, 5],
38 "sPaginationType": "full",
39 "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12],
42 $("#enrolmentperioddate").datepicker({
44 }); // Require that "until date" be in the future
46 if ($("#branches option:selected").length < 1) {
47 $("#branches option:first").attr("selected", "selected");
50 $("#categorycode").on("blur",function(){
54 $("#category_form").validate({
60 description: "required",
62 required: function(element){
63 return $("#enrolmentperioddate").val() === "";
66 enrollment_period: true,
69 enrolmentperioddate: {
70 required: function(element){
71 return $("#enrolmentperiod").val() === "";
73 enrollment_period: true
75 dateofbirthrequired: {
90 min_password_length: {
96 required: __("Please choose an enrollment period in months OR by date.")
98 enrolmentperioddate: {
99 required: __("Please choose an enrollment period in months OR by date.")