You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
I have a custom control using React-Select as its component property. Even though the field was loaded with an initial value, the field is still reported as valid=false on submit. Its validity state is not recomputed after the change or on submit, in contrast to the other non-custom fields.
Steps to Reproduce
Here's what I understand is happening based on the redux log:
When the form is mounted, setErrors is called on each field in the form. Since the fields are initially empty (thus violating the validators), each field's .valid property is set to false.
Values are loaded (e.g. from DB)
A second batch of setErrors is triggered. Somehow only the validity of non-custom controls are re-computed even though all of them have validators and all their values have changed. As a result, the non-custom controls have the correct validity state, but the custom controls have an incorrect validity state.
When submit is called, the custom controls report validation errors despite having the correct values.
In the screenshot above:
initial rrf/setErrors on hotel.name
initial rrf/setErrors on hotel.activities
silent rrf/change on hotel (to load values)
triggered rrf/setErrors on hotel.name
MISSINGrrf/setErrors on hotel.activities -- why?
Expected Behavior
When the form values change, the validity of custom controls are recomputed.
Actual Behavior
When the form values change, the validity of custom controls are not recomputed.
Note that I am using actions.change instead of actions.load as a workaround to a previous issue (#952).
The text was updated successfully, but these errors were encountered:
niawdeleon
changed the title
Custom control does not re-validate on submit
Custom control does not re-validate on submit / form change
Nov 18, 2017
niawdeleon
changed the title
Custom control does not re-validate on submit / form change
Custom control does not re-validate on submit / parent model change
Nov 18, 2017
@davidkpiano I'm trying to read the codebase but I'm having a hard time finding the mechanism by which each control in the form is validated when the entire form's model is validated. What calls the initial sequence of rrf/setErrors on each form control? And then after calling actions.change(model) on the form's model, another set of rrf/setErrors is triggered. Where does this happen?
The Problem
I have a custom control using React-Select as its component property. Even though the field was loaded with an initial value, the field is still reported as
valid=false
on submit. Its validity state is not recomputed after the change or on submit, in contrast to the other non-custom fields.Steps to Reproduce
Here's what I understand is happening based on the redux log:
setErrors
is called on each field in the form. Since the fields are initially empty (thus violating the validators), each field's.valid
property is set tofalse
.setErrors
is triggered. Somehow only the validity of non-custom controls are re-computed even though all of them have validators and all their values have changed. As a result, the non-custom controls have the correct validity state, but the custom controls have an incorrect validity state.In the screenshot above:
rrf/setErrors
on hotel.namerrf/setErrors
on hotel.activitiesrrf/change
on hotel (to load values)rrf/setErrors
on hotel.namerrf/setErrors
on hotel.activities -- why?Expected Behavior
When the form values change, the validity of custom controls are recomputed.
Actual Behavior
When the form values change, the validity of custom controls are not recomputed.
Reproducible Code Example
CodePen
Note that I am using actions.change instead of actions.load as a workaround to a previous issue (#952).
The text was updated successfully, but these errors were encountered: