Altinn / app-frontend-react

Altinn application React frontend
BSD 3-Clause "New" or "Revised" License
14 stars 24 forks source link

Number of positions left in repeating group #2035

Open xmrsa opened 3 weeks ago

xmrsa commented 3 weeks ago

Description of the bug

I have a field in a repeating group with a frontend-restriction of 9 digits (actually char, since it is a string). When I write a number, it shows the number of positions left correctly. But after I have saved the value and opened the row again, it shows the incorrect message "Du har 9 av 9 tegn igjen" (the field is already full). It does not matter the value in the field has f.ex. 3, 4 or 9 digits, the massage is always the same. If I start editing in the opened field again, it behaves as expected.

Steps To Reproduce

  1. Fill in a field in a repeating group with a number (or text) that has a restriction for "maxLength", in my case "maxLength": 9.
  2. Close the row and open it again, the incorrect massage should show DuHar9av9TegnIgjen

I don't know it this would have happened if my repeating group had a table layout.

Additional Information

Here is the code for the page that has the problem: { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/layout/layout.schema.v1.json", "data": { "layout": [ { "id": "Header-XkWm6K", "type": "Header", "size": "L", "textResourceBindings": { "title": "ra0481.S04_Poolordning.Header-XkWm6K.title" } }, { "id": "Header-efFwLL", "type": "Header", "size": "h4", "textResourceBindings": { "title": "ra0481.S04_Poolordning.Header-efFwLL.title" } }, { "id": "RadioButtons-deltok-i-pool", "type": "RadioButtons", "dataModelBindings": { "simpleBinding": "SkjemaData.f502_Pool.f502_PDeltokPool" }, "required": false, "optionsId": "JaNeiOptionlist", "layout": "column", "textResourceBindings": { "title": "ra0481.S04_Poolordning.Radio-deltok-poolordning" } }, { "id": "Group-RXVisI", "children": [ "Header-nytt-foretak-i-poolordning", "Input-orgnrForetakPool-8sNME1", "Input-navnForetakPool-MUjdeQ" ], "type": "RepeatingGroup", "tableColumns": { "Header-nytt-foretak-i-poolordning": { "showInExpandedEdit": true }, "Input-orgnrForetakPool-8sNME1": { "editInTable": false, "showInExpandedEdit": true, "width": "16%", "textOverflow": { "lineWrap": true, "maxHeight": 5 } }, "Input-navnForetakPool-MUjdeQ": { "editInTable": false, "showInExpandedEdit": true, "width": "50%", "textOverflow": { "lineWrap": true, "maxHeight": 5 } } }, "maxCount": 100, "textResourceBindings": { "add_button_full": "ra0481.S04_Poolordning.legg-til-knapp.title", "edit_button_close": "ra0481.S04_Poolordning.kun-lagre-tekst.knapp", "save_button": "ra0481.S04_Poolordning.kun-lagre-tekst.knapp" }, "dataModelBindings": { "group": "SkjemaData.f502_ForetakPool" }, "edit": { "openByDefault": true, "alwaysShowAddButton": true, "editButton": true }, "validateOnSaveRow": [ "All" ] }, { "id": "Header-nytt-foretak-i-poolordning", "type": "Header", "textResourceBindings": { "title": "ra0481.S04_Poolordning.Header-rIpWwL.title" }, "size": "h3" }, { "id": "Input-orgnrForetakPool-8sNME1", "type": "Input", "dataModelBindings": { "simpleBinding": "SkjemaData.f502_ForetakPool.f502_orgnrForetakPool" }, "required": false, "textResourceBindings": { "tableTitle": "ra0481.S04_Poolordning.Input-8sNME1.title", "title": "ra0481.S04_Poolordning.Input-8sNME1.title" }, "maxLength": 9, "autocomplete": "off", "formatting": { "align": "left", "number": { "allowNegative": false, "allowLeadingZeros": true, "decimalScale": 0 } }, "grid": { "innerGrid": { "xs": 8, "md": 6, "lg": 3, "xl": 3 } } }, { "id": "Input-navnForetakPool-MUjdeQ", "type": "Input", "dataModelBindings": { "simpleBinding": "SkjemaData.f502_ForetakPool.f502_navnForetakPool" }, "required": true, "textResourceBindings": { "tableTitle": "ra0481.S04_Poolordning.Input-MUjdeQ.title", "title": "ra0481.S04_Poolordning.Input-MUjdeQ.title" } }, { "id": "Checkboxes-0fQ6O3", "type": "Checkboxes", "dataModelBindings": { "simpleBinding": "SkjemaData.f502_FraktkPool.f502_typeKontraktPool" }, "required": false, "textResourceBindings": { "title": "ra0481.S04_Poolordning.Checkboxes-0fQ6O3.title" }, "optionsId": "f502_FraktkontraktPoolValg" }, { "id": "TextArea-MFp4Ta", "type": "TextArea", "dataModelBindings": { "simpleBinding": "SkjemaData.f502_FraktkPool.f502_annenKontraktSpes" }, "required": false, "textResourceBindings": { "title": "ra0481.S04_Poolordning.TextArea-MFp4Ta.title" } }, { "id": "TextArea-78Kdag", "type": "TextArea", "dataModelBindings": { "simpleBinding": "SkjemaData.f502_KommSide.f502_kommPoolordning" }, "required": false, "textResourceBindings": { "title": "lang.kommentarer.til.spoersmaal.siden.title" } }, { "id": "NavigationButtons-wjTnt0", "showBackButton": true, "textResourceBindings": { "next": "lang.tittel.navigation.neste", "back": "lang.tittel.navigation.tilbake" }, "type": "NavigationButtons" } ] } }