Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeating inputs, async blur validation #869

Closed
mbahoshy opened this issue Apr 26, 2016 · 4 comments
Closed

Repeating inputs, async blur validation #869

mbahoshy opened this issue Apr 26, 2016 · 4 comments
Labels

Comments

@mbahoshy
Copy link

mbahoshy commented Apr 26, 2016

I cannot seem to get the async blur validation working properly for repeating field inputs.

Given the following form, I would expect the blur validation to fire on the items[].key input, but it does not.

const TestForm = reduxForm({
  form: 'testForm',
  fields: [
    'items[].key',
    'items[].alias',
    'items[].quantity',
    'items[].category',
    'items[].displayOrder',
  ],
  validate,
  asyncValidate,
  asyncBlurFields: ['items[].key'],
})(FormHtml);

However if I explicitly supply an index, it does work for that index. In the example below, blur validation will fire on the first instance of items[].key:

const TestForm = reduxForm({
  form: 'testForm',
  fields: [
    'items[].key',
    'items[].alias',
    'items[].quantity',
    'items[].category',
    'items[].displayOrder',
  ],
  validate,
  asyncValidate,
  asyncBlurFields: ['items[0].key'],
})(FormHtml);
@mbahoshy
Copy link
Author

I see know that it will trigger blur validation on submit for these types of inputs... may not be a bug, but it is not ideal

@erikras
Copy link
Member

erikras commented Apr 27, 2016

This is definitely a bug. It's just doing an === check from each form name with the items in asyncBlurFields, and it needs to be doing a smarter "indexless" check.

@erikras erikras added the bug label Apr 27, 2016
@erikras
Copy link
Member

erikras commented Apr 27, 2016

Should work in v5.2.2.

erikras added a commit that referenced this issue Apr 27, 2016
erikras added a commit that referenced this issue May 18, 2016
@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants