I have a dynamic form field that is required based on the value of a form selected field. ie If the value of a certain field is "Yes" then the comment box is required and if "No" then it is not required.
If I initially select "Yes" and touch and blur the comment field the validation will return the required error. But after if I switch to "No" and back to "Yes" the validation error no longer occurs. If I type into the comment box and remove the validation will occur again.
I am using field level validation and have also use sync validation with the same issue.
<Field name={`${fieldId}.comment`} validate={condition.required ? [required] : []} label={condition.label} className="form-control" component={renderTextField} />
Where condition is the check to see whether the field should be required.
The logic is correct as the validation work on initial selection and if you fill the comment field and remove the text but it just does not seem to receive the validation error.
Thanks in advance