Skip to content

Commit

Permalink
Update radio input to show required attribute in fieldset
Browse files Browse the repository at this point in the history
  • Loading branch information
spokenbird committed Feb 13, 2024
1 parent 9b180c8 commit ddde6cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/resources/templates/fragments/inputs/radio.html
Expand Up @@ -18,6 +18,7 @@
th:aria-disabled="${disabled}"
th:attr="
aria-invalid=${hasError},
aria-required=${isRequiredInput},
data-follow-up=${followUpId}">
<span th:text="${label}"></span>
<p th:if="${hasHelpText}"
Expand Down
Expand Up @@ -4,6 +4,7 @@
hasHelpText=${!#strings.isEmpty(fieldsetHelpText)},
hasLabel=${!#strings.isEmpty(label)},
hasAriaLabel=${!#strings.isEmpty(ariaLabel)},
isRequiredInput=${requiredInputs.contains(inputName)},
hasError=${
errorMessages != null &&
errorMessages.get(inputName) != null &&
Expand All @@ -19,16 +20,17 @@
<legend class="form-question"
th:id="${inputName + '-legend'}"
th:inline="text">
[[${label}]]
<span th:text="${label}"></span>
<span th:if="${isRequiredInput}" class="required-input" aria-hidden="true">*</span>
<p class="text--help spacing-below-0 text--normal"
th:if="${hasHelpText}"
th:id="${inputName + '-help-text'}"
th:text="${fieldsetHelpText}"></p>
<th:block
th:replace="~{fragments/inputError :: validationError(inputName=${inputName})}"></th:block>
</legend>
<input type="hidden" th:id="${inputName} + 'Hidden'" th:name="${inputName}" value="">
<th:block th:replace="${content}"/>
</fieldset>
<th:block
th:replace="~{fragments/inputError :: validationError(inputName=${inputName})}"></th:block>
</div>
</th:block>

0 comments on commit ddde6cf

Please sign in to comment.