Reputation: 2690
On an input I have added a required
validate function. When I check the checkbox below I can disable this input. But if the user have already had an action on it (onBlur I think) the value syncErrors in my redux store stay. So when I disabled the input I keep it required.
How can I manage to remove this value from syncErrors.
Upvotes: 0
Views: 1701
Reputation: 4889
You can dynamically remove required
validate function from input when 'disabled' checkbox is checked.
No validators -> no syncErrors.
const firstNameFieldValidators = isDisabledValue ? [] : [required];
<Field
name="firstName"
type="text"
component={renderField}
validate={firstNameFieldValidators}
disabled={isDisabledValue}
label="First Name"
/>
Upvotes: 1