Removing validation when the Redux-Form field is disabled

I use the Redux v6.5.0 form and have Delete check for any field when disabled details are transmitted as true .

I wrote custom logic to disable validation inside render () of a custom field component, but it looks like this: updateSyncErrors () is not called on the form even after updating the values ​​manually. Because of this, the syncErrors object saves a field validation error.

if (field.disabled) { field.meta.invalid = false; field.meta.error = undefined; field.meta.valid = true; } 

Can we have a straightforward approach - a simple and effective approach that eliminates this requirement and eliminates this problem?

+5
source share
1 answer

You can disable the validation of a specific field by passing an disableValidation array with the field names in the form configuration object. You can then check to see if this array contains a field name and whether the field provides validation functions.

I assume the example will demonstrate this best: https://www.webpackbin.com/bins/-Kf7WYdGZtEypx080L99

0
source

Source: https://habr.com/ru/post/1264872/


All Articles