Altinn / Altinn/app-frontend-react
Validation issues does not show up for PersonLookup in a RepeatingGroup
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 33
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 3
Description
### Description of the bug
When using the PersonLookup component inside a RepeatingGroup, validation errors set through an IFormDataValidator on the person_lookup_name dataModelBinding do not appear on the component itself. Instead, the error only shows on the group row.
The validation message appears as expected when the PersonLookup component is placed outside a group. The error also shows correctly if the validation is set on a data model field used by other component types.
The expected behaviour is that the validation message should be displayed directly on the PersonLookup component, in the same way it works when the component is not inside a RepeatingGroup.
In RepeatingGroup:
Outside RepeatingGroup:
Http-response:
```json
{
"validationIssues": {
"Altinn.App.Logic.Validation.RevisorValidator-Model": [
{
"severity": 1,
"dataElementId": "8d3033e9-e466-4d13-9757-b83e36da62eb",
"field": "Oppdragsansvarlig.NyeRegistreringer[0].Navn",
"code": null,
"description": "Oppgitt person er ikke statsautorisert revisor.",
"source": "Altinn.App.Logic.Validation.RevisorValidator-Model",
"customTextKey": "Error-IkkeAutorisertRevisor"
},...
```
[Form layout](https://altinn.studio/repos/krt/krt-1017a-1/src/commit/8f8944b7c98d9c61441d05d305e4cfafa2fad08e/App/ui/form/layouts/4.json#L140):
```json
{
"id": "4-2-1-RepeatingGroup",
"type": "RepeatingGroup",
"dataModelBindings": {
"group": "Oppdragsansvarlig.NyeRegistreringer"
},
"children": [
"4-2-1-PersonLookup",
"4-2-2-Datepicker"
],
"tableHeaders": [
"4-2-1-PersonLookup",
"4-2-2-Datepicker"
],
"maxCount": 999,
"edit": {
"openByDefault": true
},
"hidden": [
"notEquals",
[
"component",
"4-2-RadioButtons"
],
true
]
},
{
"id": "4-2-1-PersonLookup",
"type": "PersonLookup",
"dataModelBindings": {
"person_lookup_ssn": "Oppdragsansvarlig.NyeRegistreringer.Personnummer",
"person_lookup_name": "Oppdragsansvarlig.NyeRegistreringer.Navn"
},
"textResourceBindings": {
"title": "4-2-1-PersonLookup.title",
"help": "4-2-1-PersonLookup.help",
"description": "4-2-1-PersonLookup.description"
},
"required": true
}
```
### Steps To Reproduce
1. Place a PersonLookup component in a repeating group
2. Add an validation issue on the data model field specified in dataModelBindings.person_lookup_name in the PersonLookup component.
3. Observe that the validation issue is not shown under the component.
### Additional Information
_No response_
Contributor guide
Research direction
Start with the linked form layout at layouts/4.json and trace how the PersonLookup and RepeatingGroup handle validation issues. Reproduce the case using an IFormDataValidator issue on the person_lookup_name binding, then compare it with the same component outside a group. Done means the validation message appears directly on PersonLookup inside the RepeatingGroup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100