Skip to content

Commit 3bf8f10

Browse files
committed
Merge branch '6.0/add-custom-field-validation-indicator' into 6.0-trunk
2 parents dd3e541 + c378deb commit 3bf8f10

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

share/html/Elements/EditCustomField

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ if ( $error_msg ) {
158158
</%perl>
159159
<span id="<% $CFHintId %>" class="form-text invalid-feedback cfinvalidfield d-inline-block"><% $error_msg %></span>
160160
% } elsif ($ShowHints and $CustomField->FriendlyPattern) {
161-
<span id="<% $CFHintId %>" class="form-text cfhints d-inline-block">
161+
% my $pattern = $CustomField->Pattern;
162+
% my $pattern_allows_empty = '' =~ m/$pattern/ ? 1 : 0;
163+
<span id="<% $CFHintId %>" class="form-text cfhints d-inline-block<% $pattern_allows_empty ? '' : ' required' %>">
162164
<% $CustomField->FriendlyPattern %>
163165
</span>
164166
% }

share/static/css/elevator/forms.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,3 +682,13 @@ div.label svg[height="12"] {
682682
.form-check.has-text-input input.form-check-input {
683683
margin-top: 0.6rem;
684684
}
685+
686+
/* display a red asterisk beside labels for required custom fields */
687+
div.col:has(span.cfhints.required) div.rt-label label::after {
688+
color: var(--bs-form-invalid-color);
689+
content: ' *';
690+
font-size: 1.1em;
691+
font-weight: bold;
692+
position: relative;
693+
top: 0.2em;
694+
}

0 commit comments

Comments
 (0)