Skip to content

Commit b25294c

Browse files
Merge branch 'w2p-122005_fixed-dropdown-values-resetting-on-enter_contribute-7.6' into dspace-7_x
# Conflicts: # src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.html
2 parents 33fdee5 + ed4e794 commit b25294c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,20 @@
4040
(scrolled)="onScroll()"
4141
[scrollWindow]="false">
4242

43-
<button class="dropdown-item disabled" *ngIf="optionsList && optionsList.length === 0">{{'form.no-results' | translate}}</button>
43+
<button class="dropdown-item disabled" type="button" *ngIf="optionsList && optionsList.length === 0">
44+
{{ 'form.no-results' | translate }}
45+
</button>
4446
<button class="dropdown-item collection-item text-truncate"
4547
(click)="onSelect(undefined); sdRef.close()" (mousedown)="onSelect(undefined); sdRef.close()"
4648
title="{{ 'dropdown.clear.tooltip' | translate }}" role="option"
47-
>
49+
type="button">
4850
<i>{{ 'dropdown.clear' | translate }}</i>
4951
</button>
5052
<button class="dropdown-item collection-item text-truncate" *ngFor="let listEntry of optionsList; let i = index"
5153
[class.active]="i === selectedIndex"
5254
(keydown.enter)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
53-
title="{{ listEntry.display }}" role="option"
54-
[attr.id]="listEntry.display == (currentValue|async) ? ('combobox_' + id + '_selected') : null">
55+
title="{{ listEntry.display }}" role="option" type="button"
56+
[attr.id]="listEntry.display === (currentValue|async) ? ('combobox_' + id + '_selected') : null">
5557
{{inputFormatter(listEntry)}}
5658
</button>
5759
<div class="scrollable-dropdown-loading text-center" *ngIf="loading"><p>{{'form.loading' | translate}}</p></div>

src/app/shared/form/form.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ export class FormService {
130130
}
131131

132132
public addControlErrors(field: AbstractControl, formId: string, fieldId: string, fieldIndex: number) {
133+
if (field.errors === null) {
134+
return;
135+
}
133136
const errors: string[] = Object.keys(field.errors)
134137
.filter((errorKey) => field.errors[errorKey] === true)
135138
.map((errorKey) => `error.validation.${errorKey}`);

0 commit comments

Comments
 (0)