dev/core#1928 Fix HTML5 error due to required attribute being set switch to using...
authorSeamus Lee <seamuslee001@gmail.com>
Thu, 6 Aug 2020 01:18:33 +0000 (11:18 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Thu, 6 Aug 2020 01:18:33 +0000 (11:18 +1000)
CRM/Core/Form.php

index ae4391a37170d64d861b28f26e8920b19fc05e8d..9f589ff1532d3ac30beaaa8888da0d8d47ab9839 100644 (file)
@@ -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);