Skip to content

Custom text in error message box not working from Button #8254

@xmrsa

Description

@xmrsa

Description

When putting a trigger on the Next-button like this
image
I expected to see my custom error message at the top of the page when i pressed the button without filling in the field on the page. It only gives me the standard text:
image

To Reproduce

  1. Create a Next-button with "triggers": ["validatePage"] on the same page as you have a custom validation for a required field. (mine was an integer field)
  2. Do NOT put a value in the required field, but press the Next-button directly
  3. The standard text for the error box is shown at the top of the page. This standard text does not fit the UU-criteria for development.

I tried to make this work in this form https://ssb.apps.tt02.altinn.no/ssb/ra0678/.

Expected behavior

I expected this kind of code
image
in ValidationHandler.cs to return my customized text in the Error box. The message on the field itself is shown correctly.

Screenshots

Here is the kind of message that I expected to see:
image

Additional info

The error text is shown as expected when I trigger the validation that is defined directly on the field. But then I have to first put a value on the field and then delete it again.

Interestingly enough this also worked as expected if I used validateAllPages instead of validatePage
"triggers": ["validateAllPages" ],
I tested this in Chrome.

Metadata

Metadata

Assignees

Labels

kind/bugUsed when there is a defect / something is not working as it should.org/ssbIssues relevant for Statistisk sentralbyrå.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions