asyncValidate嵌套字段onBlur

时间:2017-10-03 14:22:38

标签: javascript reactjs redux-form

我想在onBlur嵌套字段上使用asyncValidate,但没有任何反应。如果我只传递一个字符串一切正常。我做错了什么以及如何修复我的代码:

<Field
    name="array[0].code" // works fine and data saves in the right field
    type="text"
    component={renderField}
/>

const formRedux = reduxForm({
    form: 'form',
    destroyOnUnmount: false,
    forceUnregisterOnUnmount: true,
    validate,
    asyncValidate,
    asyncBlurFields: ['array[0].code'], //doesn't work out
})(formRedux);

1 个答案:

答案 0 :(得分:1)

你需要在没有索引的情况下编写它:

asyncBlurFields: ['array[].code']