Skip to content

Commit

Permalink
Focus batch name field if invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
KochTobi committed Oct 21, 2024
1 parent 5ab1d11 commit d1a6105
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,13 @@ public void close() {
protected void onConfirmClicked(ClickEvent<Button> clickEvent) {
if (batchNameField.isInvalid()) {
// once the user focused the batch name field at least once, the setRequired(true) validation is applied.
batchNameField.focus();
return;
}
if (batchNameField.isEmpty()) {
// if the user never focused the name field, no validation took place. Thus, the need to double-check here.
batchNameField.setInvalid(true);
batchNameField.focus();
return;
}
fireEvent(new ConfirmEvent(this, clickEvent.isFromClient(), batchNameField.getValue(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,13 @@ public Registration addCancelListener(ComponentEventListener<CancelEvent> listen
protected void onConfirmClicked(ClickEvent<Button> clickEvent) {
if (batchNameField.isInvalid()) {
// once the user focused the batch name field at least once, the setRequired(true) validation is applied.
batchNameField.focus();
return;
}
if (batchNameField.isEmpty() || batchNameField.getValue().isBlank()) {
// if the user never focused the name field, no validation took place. Thus, the need to double-check here.
batchNameField.setInvalid(true);
batchNameField.focus();
return;
}
if (validatedSampleMetadata.isEmpty() && uploadWithDisplay.getUploadedData().isEmpty()) {
Expand Down

0 comments on commit d1a6105

Please sign in to comment.