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.")
24 $(document).ready(function() {
25 KohaTable("patron_categories", {
31 "aTargets": [3, 4, 5],
34 "sPaginationType": "full",
35 "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12],
38 if ($("#branches option:selected").length < 1) {
39 $("#branches option:first").attr("selected", "selected");
42 $("#categorycode").on("blur",function(){
46 $("#category_form").validate({
52 description: "required",
54 required: function(element){
55 return $("#enrolmentperioddate").val() === "";
58 enrollment_period: true,
61 enrolmentperioddate: {
62 required: function(element){
63 return $("#enrolmentperiod").val() === "";
65 enrollment_period: true
67 password_expiry_days: {
70 dateofbirthrequired: {
85 min_password_length: {
91 required: __("Please choose an enrollment period in months OR by date.")
93 enrolmentperioddate: {
94 required: __("Please choose an enrollment period in months OR by date.")