Description of the bug
Characters from formatting count towards maxLength for Input fields, this causes the count of remaining symbols to be incorrect. The following image shows an input field that should say "Du har 7 tegn igjen", it shows 0 due to formatting inserting spaces for numbers, and two punctuations.
Additionally formatting characters count towards the maxlength without accounting for characters consumed by formatting, adjusting to account for maximum length causes maxLength to initially be too large.
Correct behaviour would be to store input to formatted number separately from visual formatting, read maxLength from input while applying format visually.
Steps To Reproduce
- Make blank page in altinn studio
- Use input field with both formatting and maxLength
Additional Information
Code for field shown:
{
"id": "S08-Input-Kontonummer",
"type": "Input",
"textResourceBindings": {
"title": "S08-Input-Kontonummer.Title",
"description": "S08-Input-Kontonummer.Description"
},
"dataModelBindings": {
"simpleBinding": {
"field": "FlatData.Kontonummer",
"dataType": "DataModel"
}
},
"formatting": {
"number": {
"format": "####.##.#####",
"allowLeadingZeros": true
}
},
"required": true,
"maxLength": 13
},
Description of the bug
Characters from formatting count towards maxLength for Input fields, this causes the count of remaining symbols to be incorrect. The following image shows an input field that should say "Du har 7 tegn igjen", it shows 0 due to formatting inserting spaces for numbers, and two punctuations.
Additionally formatting characters count towards the maxlength without accounting for characters consumed by formatting, adjusting to account for maximum length causes maxLength to initially be too large.
Correct behaviour would be to store input to formatted number separately from visual formatting, read maxLength from input while applying format visually.
Steps To Reproduce
Additional Information
Code for field shown: