Skip to content

AB#128603 - ABC - Custom label for form buttons#2845

Merged
AntoineRelief merged 3 commits intonextfrom
AB#128603
Apr 22, 2026
Merged

AB#128603 - ABC - Custom label for form buttons#2845
AntoineRelief merged 3 commits intonextfrom
AB#128603

Conversation

@Joselgc1
Copy link
Copy Markdown
Contributor

@Joselgc1 Joselgc1 commented Mar 30, 2026

Description

Forms were always using the same save and draft labels, including when the same form was opened inline or in a modal. Admins can now configure normal text or SurveyJS-style expressions for both actions in the Form Builder, with separate modal overrides available under Navigation > Advanced so labels like “Save and Send” or “Update draft” can change based on answers such as status, while still falling back to the existing translated defaults when no custom value is set.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Improvement (refactor or addition to existing functionality)

Screenshots

image image

To change a form's labels

image image image

To change a form's modal Labels

image image

Checklist:

( * == Mandatory )

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-frontend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

cdkFocusInitial
>
{{ 'components.record.modal.update' | translate }}
{{ saveButtonLabel || ('components.record.modal.update' | translate) }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Joselgc1
Requested change
The save button label should not be the same between the form modal & the form
By default, the text isn't the same, so we must have 2 distinct options

Copy link
Copy Markdown
Contributor Author

@Joselgc1 Joselgc1 Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in new commit.

* @param propertyName Serializer property name (e.g. saveButtonLabel)
* @returns Evaluated label, or empty string if unset (template uses default i18n)
*/
export function evaluateSurveyActionButtonLabel(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Joselgc1
If you can give me example with working expression in details of PR please

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working Expression Examples:

The new button-label settings accept either:

  • Plain text, for example Save changes
  • A SurveyJS expression, when the value contains {...} and resolves to a string

Examples below assume the form has a status question.

saveButtonLabel: iif({status} = 'draft', 'Continue editing', 'Save form')
Result:

  • In the regular form, if status = 'draft', the button shows Continue editing
  • Otherwise it shows Save form

modalSaveButtonLabel: iif({status} = 'draft', 'Update draft', 'Update record')
Result:

  • In the form modal, if status = 'draft', the button shows Update draft
  • Otherwise it shows Update record

saveAsDraftButtonLabel: iif({status} = 'draft', 'Update saved draft', 'Save as draft')
Result:

  • If status = 'draft', the draft button shows Update saved draft
  • Otherwise it shows Save as draft

Additional info:

  • If the value does not contain {}, it is treated as a plain static label
  • If the value contains {}, it is evaluated through survey.runExpression(...)
  • The expression must resolve to a string, otherwise the raw configured value is used as fallback

One important note:

  • With the current code, modalSaveButtonLabel falls back to saveButtonLabel when modalSaveButtonLabel is empty. Same for modalSaveAsDraftButtonLabel and saveAsDraftButtonLabel.

@AntoineRelief AntoineRelief merged commit 62b0f9f into next Apr 22, 2026
1 check failed
@AntoineRelief AntoineRelief deleted the AB#128603 branch April 22, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants