From 996b358b2f124c8f8d5a20bb5e7a5b472c96d57b Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Thu, 6 Aug 2020 11:18:33 +1000 Subject: [PATCH] dev/core#1928 Fix HTML5 error due to required attribute being set switch to using a class as jquery.validation picks up the class as well --- CRM/Core/Form.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index ae4391a371..9f589ff153 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1205,10 +1205,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page { } } } - $element = $this->createElement('radio', NULL, NULL, $var, $key, $optAttributes); + // We use a class here to avoid html5 issues with collapsed cutsomfield sets. + $optAttributes['class'] = $optAttributes['class'] ?? ''; if ($required) { - $element->setAttribute('required', TRUE); + $optAttributes['class'] .= ' required'; } + $element = $this->createElement('radio', NULL, NULL, $var, $key, $optAttributes); $options[] = $element; } $group = $this->addGroup($options, $name, $title, $separator); -- 2.25.1