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 Formfields for nested objects #1092

Open
qroac opened this issue Jun 4, 2019 · 4 comments
Open

Validate Formfields for nested objects #1092

qroac opened this issue Jun 4, 2019 · 4 comments

Comments

@qroac
Copy link
Contributor

qroac commented Jun 4, 2019

I have a problem to validate formfields of nested objects that are managed in the same form as the main object.

e.g. for management of tasks:

  • Title: Title of Task
  • Desc: Description of Task
  • step[0] Title: Title of first Step
  • step[0] Desc: Description of first Step
  • step[1] Title: Title of second Step
  • step[1] Desc: Description of second Step

It is no problem to send forms like this to the backend. But I cannot find a way to use the current validation method to validate the nested formfields.

Describe the solution you'd like
I think it would be great to have a notation like this for the validation of form fields:

  • "field": validators for simple field, as it is now
  • "nestedList[].field": validators applied for "field" of every item in the nested list
  • "nestedList[]": special array validators e.g. for requireing min/max amount of items in that list
@larixer
Copy link
Member

larixer commented Jun 4, 2019

@qroac
Copy link
Contributor Author

qroac commented Jun 6, 2019

Yes, I already tried to figure out if I already can use it for my case.
Do you think it could already work?
How would I define the validation entry e.g. for step[i].title?

@larixer
Copy link
Member

larixer commented Jun 6, 2019

@Theweird Why do you think it shouldn't work? I think it should work, based on the code I see there

@larixer
Copy link
Member

larixer commented Jun 6, 2019

@Theweird How about actually trying to read this code and run it in the debugger if you don't understand it. or insert console.log ? This code is open, it is small, you can read it and figure out what it is doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants