Skip to content

Commit

Permalink
Avoid repeating identical error messages
Browse files Browse the repository at this point in the history
If an error message is available for a Zend_Form_Element_Multiselect element, the identical message is repeated for each item of the multiselect element. To avoid this, we can only display the unique error messages per element.
  • Loading branch information
nicoschefer committed Mar 12, 2020
1 parent ad46372 commit 5bf1a68
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/Zend/Form/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -2276,6 +2276,7 @@ protected function _getErrorMessages()
foreach ($value as $val) {
$aggregateMessages[] = str_replace('%value%', $val, $message);
}
$aggregateMessages = array_unique($aggregateMessages); //prevent repeating the identical error message for multichoice-items
if (count($aggregateMessages)) {
if ($this->_concatJustValuesInErrorMessage) {
$values = implode($this->getErrorMessageSeparator(), $value);
Expand Down

0 comments on commit 5bf1a68

Please sign in to comment.