COMCL-640: Ensure submit buttons will validate the form properly #1026
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses an issue where users are unable to create a new communication type activity under the contacts form New Activity. The problem occurs due to the Draft button being added to the New Activity form, which introduces a new button ID that is not accounted for in CiviCRM's form validation process.
uk.co.compucorp.civicase/CRM/Civicase/Hook/BuildForm/HandleDraftActivities.php
Lines 77 to 91 in eaefbbd
After adding the button in the hook above, the new button ID is not catered for in CiviCRM https://github.com/civicrm/civicrm-core/blob/920907161e991952f07eb4b73910886022e8c414/templates/CRM/Core/Form/RecurringEntity.tpl#L209 where submit buttons are not expected to validate unchanged elements.
Before
Users were unable to create activities under the contacts forms New Activity.
After
Users can now successfully create activities under the contacts forms New Activity.
Technical Implementation
The fix involves adding a new hook_civicrm_alterContent() implementation in civicase.php. This hook modifies the content of the Activity form template to include all relevant button IDs for proper form validation.