Skip to content

Commit 667b67c

Browse files
committed
FLS-1423 - Use 'Save' not 'Save and add another' on button if not possible to add another
1 parent 4ef28ee commit 667b67c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

e2e-test/cypress/e2e/designer/multiInputFieldEdit.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ Feature: Multi Input Field Edit
155155
When I enter "First item" for "Item name"
156156
And I click "Save and add another"
157157
When I enter "Second item" for "Item name"
158-
And I click "Save and add another"
158+
And I click "Save"
159159
Then I should not see the "Save and add another" button
160+
And I should not see the "Save" button
160161
And I should see the "Save and continue" button

runner/src/server/plugins/engine/page-controllers/RepeatingFieldPageController.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ export class RepeatingFieldPageController extends PageController {
241241
};
242242

243243
response.source.context.maxMultiInputFieldRows = this.inputComponent.options?.maxMultiInputFieldRows;
244+
245+
const maxRows = this.inputComponent.options?.maxMultiInputFieldRows;
246+
const currentRowCount = rows ? rows.length : 0;
247+
248+
if (maxRows && (currentRowCount >= maxRows - 1)) {
249+
this.saveText = this.model?.def?.metadata?.isWelsh ? "Cadw" : "Save";
250+
}
244251
}
245252
}
246253

0 commit comments

Comments
 (0)