Validation errors in programmatically-set array items do not show up #641
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.
The bug may appear when the following conditions are met:
minLength
) on array itemssetValue()
bootstrap2
orbootstrap3
One would expect the validation error to show next to the input field, after using
setValue()
.The current, unexpected behavior is that validation errors do not show up.
This is because the array items are inserted on-the-fly, and the
input.controlgroup
property may not be ready fast enough, causingaddInputError
function in the theme to simply return without inserting the error class and error message.Reproduce this problem on...
JSFiddle
"minLength": 100
is added toroot.parent
, which displays just fine because it is ready early enough; however,root.children.0.child_prop
did not have any errors displayed)Demo page: since this is a rare race condition, some work is needed to reproduce it. Use this as the base, and copy and paste the following into the data textarea, and hit Update Form.
More often than not you will not see any errors below the input field for the child.
This PR attempts to fix the problem by adding a wait queue of callbacks that depend on
input.controlgroup
to be ready. When it is actually ready, callbacks on the queue, includingaddInputError
, will be executed.