mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
119799: Prevent submission from updating the dropdown values when hitting enter in another input form (onsubmit)
This commit is contained in:
@@ -41,10 +41,12 @@
|
|||||||
(scrolled)="onScroll()"
|
(scrolled)="onScroll()"
|
||||||
[scrollWindow]="false">
|
[scrollWindow]="false">
|
||||||
|
|
||||||
<button class="dropdown-item disabled" *ngIf="optionsList && optionsList.length == 0">{{'form.no-results' | translate}}</button>
|
<button class="dropdown-item disabled" type="button" *ngIf="optionsList && optionsList.length == 0">
|
||||||
|
{{ 'form.no-results' | translate }}
|
||||||
|
</button>
|
||||||
<button class="dropdown-item collection-item text-truncate" *ngFor="let listEntry of optionsList"
|
<button class="dropdown-item collection-item text-truncate" *ngFor="let listEntry of optionsList"
|
||||||
(click)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
|
(click)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
|
||||||
title="{{ listEntry.display }}" role="option"
|
title="{{ listEntry.display }}" role="option" type="button"
|
||||||
[attr.id]="listEntry.display == (currentValue|async) ? ('combobox_' + id + '_selected') : null">
|
[attr.id]="listEntry.display == (currentValue|async) ? ('combobox_' + id + '_selected') : null">
|
||||||
{{inputFormatter(listEntry)}}
|
{{inputFormatter(listEntry)}}
|
||||||
</button>
|
</button>
|
||||||
|
@@ -130,6 +130,9 @@ export class FormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public addControlErrors(field: AbstractControl, formId: string, fieldId: string, fieldIndex: number) {
|
public addControlErrors(field: AbstractControl, formId: string, fieldId: string, fieldIndex: number) {
|
||||||
|
if (field.errors === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const errors: string[] = Object.keys(field.errors)
|
const errors: string[] = Object.keys(field.errors)
|
||||||
.filter((errorKey) => field.errors[errorKey] === true)
|
.filter((errorKey) => field.errors[errorKey] === true)
|
||||||
.map((errorKey) => `error.validation.${errorKey}`);
|
.map((errorKey) => `error.validation.${errorKey}`);
|
||||||
|
Reference in New Issue
Block a user