Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The path of a validation error points always to the last inner edit grid child #5570

Open
bogist opened this issue Apr 17, 2024 · 1 comment

Comments

@bogist
Copy link

bogist commented Apr 17, 2024

Describe the bug
When there are invalid entries in some of the rows of an inner edit grid of a parent edit grid, we will notice that if we enable the validations for the given form then we will see that the links in the alerts will point to a relative path that once clicked it will redirect to the last row of the inner edit grid of the last row of the parent edit grid.

Version/Branch
latest 4.19

To Reproduce
Steps to reproduce the behavior:

  1. Create a form that contains the following:
    • Parent edit grid that allows draft rows with invalid input;
    • Each entry of the parent edit grid to contain an inner edit grid that allows draft rows with invalid input;
    • Each entry of the inner edit grid to have an input text field with any given validation required or custom.
  2. Add a button that once clicked it will display the validation errors of the form
  3. Add new entry in the parent edit grid, with two new inner edit grid entries where the first one has an invalid input and the second is valid
  4. Add another new entry in the parent edit grid only this time, we add a valid entry in the inner edit grid
  5. Save all rows
  6. Click the button to validate the form
  7. Click on one of the inner grid messages that point to a relative path to the inner edit grid sections(Not the input field message but the one that is referring to invalid rows of the inner edit grid)
  8. See that you are redirected to the valid entry of the last row of the parent edit grid, of the last inner edit grid component

Expected behavior
Every link should point to each individual path of the given component and not redirect to the last entry of the edit grid as this creates confussion

Context
The above scenario can be reproduce on https://formio.github.io/formio.js/app/sandbox with the following details:

  • Form JSON:
    { "display": "form", "components": [ { "label": "Edit Grid Parent", "tableView": false, "validate": { "required": true }, "rowDrafts": true, "key": "editGridParent", "type": "editgrid", "displayAsTable": false, "input": true, "components": [ { "label": "Edit Grid Child", "tableView": false, "validate": { "required": true }, "rowDrafts": true, "key": "editGridChild", "type": "editgrid", "displayAsTable": false, "input": true, "components": [ { "label": "Text Field", "applyMaskOn": "change", "tableView": true, "validate": { "required": true }, "key": "textField", "type": "textfield", "input": true } ] } ] }, { "label": "Validate", "action": "saveState", "showValidations": true, "tableView": false, "key": "validate", "type": "button", "input": true, "state": "draft" }, { "type": "button", "label": "Submit", "key": "submit", "disableOnInvalid": true, "input": true, "tableView": false } ] }
  • Submission JSON
    { "data": { "editGridParent": [ { "editGridChild": [ { "textField": "" }, { "textField": "the one with issue" } ] }, { "editGridChild": [ { "textField": "not the one with the issue" } ] } ], "validate": true, "submit": false }, "metadata": { "timezone": "Europe/Chisinau", "offset": 180, "origin": "https://formio.github.io", "referrer": "https://github.com/formio/formio.js/issues/5560", "browserName": "Netscape", "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36", "pathName": "/formio.js/app/sandbox", "onLine": true }, "state": "draft", "_vnote": "" }
@jeriah-formio
Copy link
Collaborator

This seems to be resolved in FJS 4.19.1.

The only validation message that will redirect the focus to a component path is the field the validation pertains to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants