Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/server/plugins/engine/components/FormComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class FormComponent extends ComponentBase {
type: FormComponentsDef['type']
hint: FormComponentsDef['hint']
label: string
summaryLabel: string

isFormComponent = true
isAppendageStateSingleObject = false
Expand All @@ -46,13 +47,18 @@ export class FormComponent extends ComponentBase {
this.hint = hint

this.label = this.getLabel(def)
this.summaryLabel = this.getSummaryLabel(def)
}

getLabel(def: FormComponentsDef) {
if ('errorDescription' in def && def.errorDescription) {
return def.errorDescription
}

return this.getSummaryLabel(def)
}

getSummaryLabel(def: FormComponentsDef) {
if ('shortDescription' in def && def.shortDescription) {
return def.shortDescription
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/plugins/engine/models/SummaryViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ export function ItemField(
label: field.title,
title:
field.options.required === false
? `${field.label} (optional)`
: field.label,
? `${field.summaryLabel} (optional)`
: field.summaryLabel,
error: field.getFirstError(options.errors),
value: getAnswer(field, state),
href: getPageHref(page, options.path, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ function getPaymentFieldItems(
name: field.name,
page,
title: field.title,
label: field.label,
label: field.summaryLabel,
field,
state: context.state,
href: page.href,
Expand Down
Loading