From 2d2cff6fc691b185f34c691b7daaa87f88b89d72 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 1 Jun 2022 14:54:34 +0200 Subject: [PATCH] Bug 30746: Fix JS error on opac-memberentry Empty PatronSelfRegistrationBorrowerMandatoryField and PatronSelfRegistrationBorrowerUnwantedField Go to opac-memberentry.pl Notice the JS error Uncaught TypeError: j is undefined Apply this patch Go to opac-memberentry.pl => no JS error Fill the pref with some values Go to opac-memberentry.pl => Confirm that the fields you marked as mandatory as flagged accordinly on the UI Signed-off-by: Lucas Gass Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit c699f05970bbef78ec07e16eac5991cd72f9b87a) Signed-off-by: Lucas Gass (cherry picked from commit ffddfb86aa5f6943012f47ee651dce9ea0891165) Signed-off-by: Arthur Suzuki --- .../bootstrap/en/modules/opac-memberentry.tt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index 91328db9e9..99f7730cea 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -1082,9 +1082,21 @@ } }); - $("input.required,select.required,textarea.required").rules("add", { - required: true - }); + if ( $("input.required").length ) { + $("input.required").rules("add", { + required: true + }); + } + if ( $("select.required").length ) { + $("select.required").rules("add", { + required: true + }); + } + if ( $("textarea.required").length ) { + $("textarea.required").rules("add", { + required: true + }); + } [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') %] -- 2.39.5