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

Validation for array fields #1321

Closed
vestrep opened this issue Dec 16, 2015 · 1 comment
Closed

Validation for array fields #1321

vestrep opened this issue Dec 16, 2015 · 1 comment

Comments

@vestrep
Copy link

vestrep commented Dec 16, 2015

Hi,
There is a problem with the validation error messages with array fields. When I use quickForm and put an element in an Array, then validation works great. But if I add an element, remove it and add a new element, then validation no validation error message apears when the field is invalid. I guess that there is a problem with the internal counter, since there is no element that has the 0 number. In this case, my first element of the Array has the number one (example: task.1.name instead of task.0,name)

@vestrep
Copy link
Author

vestrep commented Jan 14, 2016

I found what causes the problem. It's the AutoForm.Utility.compactArrays() function that is called before the values are inserted in the collection. This function removes the array item that have a null value because they were removed. For the moment I solved the problem by removing the line 344 in the autoform-api.js. It's the call to the Utility.compactArrays(). The only problem is that this causes the document to contain the null values. Maybe the array should be cleaned in the collection2 package? I don't what to make a pull request with this change because the function was visibly disigned to avoid that null values. But I found no solution to solve this problem exclusively in the Autoform package.

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