Altinn / Altinn/app-frontend-react

Validate numbers in frontend when there is a `totalDigits` constraint

Open
#2,335 0 comments 0 reactions 1 assignee Claimed by @martinothamar View on GitHub
kind/bug status/for-consideration
Dominant language
TypeScript
Stars
21
Forks
33
Avg merge
6d 23h
Merged PRs (30d)
3

Description

For a XSD schema like this:

![Image](https://github.com/user-attachments/assets/99dfb26c-b984-49aa-948b-bc2cfa8299cc)

We will generate this (in Studio):

![Image](https://github.com/user-attachments/assets/74144427-2847-403a-8267-ebb2cb3b56d2)

But it seems that is not being validated. A workaround would be setting `maximum` and `minimum` instead if the type of the number is `integer`, but it doesn't work decimal numbers. There is not JSONSchema equivalent of `xs:totalDigits` (since it accounts for digits on both sides of the decimal point). The backend C# classes are annotated with regex validation attributes, so it seems to work on the backend. So options:

* Manually validate `totalDigits` in frontend
* ???

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.