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

Validate that a nested key has children #868

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

Validate that a nested key has children #868

rvirani1 opened this issue Apr 26, 2016 · 4 comments

Comments

@rvirani1
Copy link

If I have a number of children elements nested as items, how do I write a validation that at least one child exists?

For example, if my fields look like the following:

export const fields = [
   'date',
  'items[].itemType',
  'items[].size',
  'items[].flightsOfStairs',
  'place',
  'startTime'
];

How do I validate that there is at least one item?

@erikras
Copy link
Member

erikras commented Apr 27, 2016

There is not currently a way to attach an error to an array, since arrays aren't really fields. #486 #762

The current least-worst solution is to use the form-wide _error key.

@rvirani1
Copy link
Author

Got it. I can make that work for now.

@erikras erikras closed this as completed Apr 27, 2016
@erikras
Copy link
Member

erikras commented May 4, 2016

Good news! Array validation errors in v6.0.0-alpha-7.

@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants