From: larssandergreen@gmail.com Date: Mon, 2 Aug 2021 23:03:11 +0000 (-0600) Subject: Change event registration button text based on if there are additional participants X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f3471291ad543e0f9f5b291c956f57df41ea5ce7;p=civicrm-core.git Change event registration button text based on if there are additional participants cleanup fix typo in description --- diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 163badbf5e..4f7daa1f42 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -378,8 +378,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $this->add('select', 'additional_participants', ts('How many people are you registering?'), $additionalOptions, - NULL, - ['onChange' => "allowParticipant()"] + NULL ); $isAdditionalParticipants = TRUE; } @@ -514,7 +513,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $buttonParams['name'] = ts('Register'); } else { - $buttonParams['name'] = ts('Review your registration'); + $buttonParams['name'] = ts('Review'); $buttonParams['icon'] = 'fa-chevron-right'; } diff --git a/templates/CRM/Event/Form/Registration/Register.tpl b/templates/CRM/Event/Form/Registration/Register.tpl index a76a3c8dfe..9fbd63c849 100644 --- a/templates/CRM/Event/Form/Registration/Register.tpl +++ b/templates/CRM/Event/Form/Registration/Register.tpl @@ -60,10 +60,9 @@
{$form.additional_participants.label} *
- {$form.additional_participants.html}{if $contact_id || $contact_id == NULL}{ts}(including yourself){/ts}{/if} + {$form.additional_participants.html}{if $contact_id || $contact_id == NULL} {ts}(including yourself){/ts}{/if}
- {ts}Fill in your registration information on this page. If you are registering additional people, you will be able to enter their registration information after you complete this page and click "Review your registration".{/ts} +
@@ -168,6 +167,26 @@ {/if} {literal} + CRM.$(function($) { + $('#additional_participants').change(function() { + toggleAdditionalParticipants(); + allowParticipant(); + }); + + function toggleAdditionalParticipants() { + var submit_button = $("#crm-submit-buttons > button").html(); + var review_translated = '{/literal}{ts escape="js"}Review{/ts}{literal}'; + var continue_translated = '{/literal}{ts escape="js"}Continue{/ts}{literal}'; + if ($('#additional_participants').val()) { + $("#additionalParticipantsDescription").show(); + $("#crm-submit-buttons > button").html(submit_button.replace(review_translated, continue_translated)); + } else { + $("#additionalParticipantsDescription").hide(); + $("#crm-submit-buttons > button").html(submit_button.replace(continue_translated, review_translated)); + } + } + }); + function allowParticipant() { {/literal}{if $allowGroupOnWaitlist}{literal} var additionalParticipants = cj('#additional_participants').val();