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;
+ }
+ }
+
</script>
[% END %]
<p>
[% l('Notify when hold is ready for pickup?') %]
<blockquote>
- <input type="checkbox" id="email_notify" name="email_notify" value="t"
+ <input class="hold-alert-method" type="checkbox" id="email_notify" name="email_notify" value="t"
[% IF !ctx.user.email %]disabled="true"[% ELSIF ctx.default_email_notify %]checked="checked"[% END %]/>
<label for="email_notify">[% l('Yes, by Email') %]</label><br/>
<blockquote>
ELSE; l('Email Address:') %] <span name="email_address">[% ctx.user.email %]</span>[% END %]
</blockquote>
[%- IF allow_phone_notifications == 'true' %]
- <input type="checkbox" id="phone_notify_checkbox" name="phone_notify_checkbox"
+ <input onchange="onHoldAlertMethodChanged(this)" class="hold-alert-method" type="checkbox" id="phone_notify_checkbox" name="phone_notify_checkbox"
+
+
[% IF ctx.default_phone_notify %]checked="checked"[% END %]/>
<label for="phone_notify_checkbox">[% l('Yes, by Phone') %]</label><br/>
<blockquote>
</blockquote>
[%- END -%]
[% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1 %]
- <input type="checkbox" id="sms_notify_checkbox" name="sms_notify_checkbox"
+ <input onchange="onHoldAlertMethodChanged(this)" class="hold-alert-method" type="checkbox" id="sms_notify_checkbox" name="sms_notify_checkbox"
[% IF ctx.default_sms_notify %]checked="checked"[% END %]/>
<label for="sms_notify_checkbox">[% l('Yes, by Text Messaging') %]</label><br/>
<blockquote>