Fix bug - hasMany field validation errors not displayed. #4976
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If there is a validation error with any of fields in form hasMany field changes keys of new rows from "new_X" to "new__LA_KEY_". This way no validation error is displayed and on the second submit a couple of rows will be merged to one because every new row has the same key: "new__LA_KEY_".
Sample form code:
Now if you left any of this fields empty, form won't validate.
some_relation_required_fieldwill change input name fromsome_relation_required_field[new_1]tosome_relation_required_field[new__LA_KEY_].If you left some_relation_required_field empty error won't be displayed, because form input name has changed.
Pull request resolves this issue. It's not very elegant, but I couldn't find another way to fix this issue.