Skip to content

Commit

Permalink
Merge pull request #18080 from seamuslee001/dev_core_1928
Browse files Browse the repository at this point in the history
dev/core#1928 Fix HTML5 error due to required attribute being set swi…
  • Loading branch information
seamuslee001 authored Aug 6, 2020
2 parents 3fb7c1e + 996b358 commit 5a4651d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CRM/Core/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1205,10 +1205,12 @@ public function &addRadio($name, $title, $values, $attributes = [], $separator =
}
}
}
$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);
Expand Down

0 comments on commit 5a4651d

Please sign in to comment.