From 0267482f7070ff3ebcb60e0e8f1c0ea4a92e0417 Mon Sep 17 00:00:00 2001 From: Cesar Velez Date: Wed, 24 May 2017 11:56:37 -0400 Subject: [PATCH] LP#1098685 Html5 form validation to require OPAC patron enter hold SMS info This uses Html5 form validation's require attribute that's supported since IE10. Will add custom Modernizer detect and polyfill that allows for more backward compatibility older browsers. Signed-off by: Cesar Velez --- Open-ILS/src/templates/opac/parts/js.tt2 | 26 ++++++++++++++++++++++++ Open-ILS/src/templates/opac/parts/place_hold.tt2 | 8 +++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2 index f7fc737754..845eed24c3 100644 --- a/Open-ILS/src/templates/opac/parts/js.tt2 +++ b/Open-ILS/src/templates/opac/parts/js.tt2 @@ -151,6 +151,32 @@ var aou_hash = { return false; } } + + function onHoldAlertMethodChanged(cbox){ + + switch(cbox.id){ + case "phone_notify_checkbox": + var phoneInput = document.getElementsByName("phone_notify")[0]; + if(cbox.checked) { + phoneInput.setAttribute("required",""); + } else { + phoneInput.removeAttribute("required"); + } + break; + case "sms_notify_checkbox": + var smsInput = document.getElementsByName("sms_notify")[0]; + var carrierInput = document.getElementsByName("sms_carrier")[0]; + if(cbox.checked) { + smsInput.setAttribute("required",""); + carrierInput.setAttribute("required",""); + } else { + smsInput.removeAttribute("required"); + carrierInput.removeAttribute("required"); + } + break; + } + } + [% END %] diff --git a/Open-ILS/src/templates/opac/parts/place_hold.tt2 b/Open-ILS/src/templates/opac/parts/place_hold.tt2 index 8bf17134e6..716b1209e6 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold.tt2 @@ -175,7 +175,7 @@

[% l('Notify when hold is ready for pickup?') %]

-
@@ -183,7 +183,9 @@ ELSE; l('Email Address:') %] [% ctx.user.email %][% END %]
[%- IF allow_phone_notifications == 'true' %] -
@@ -193,7 +195,7 @@
[%- END -%] [% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1 %] -
-- 2.11.0