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

naming convention configurable for repeatable fields? #147

Open
nicolasfranck opened this issue Jun 25, 2018 · 0 comments
Open

naming convention configurable for repeatable fields? #147

nicolasfranck opened this issue Jun 25, 2018 · 0 comments

Comments

@nicolasfranck
Copy link

Repeatable fields use dots in the name. While this is convenient for compound fields, this becomes a problem for repeatable fields:

e.g.

name.0

The problem here is that the index is included in the name. What if someone added this field, using javascript:

name.0
name.100

This would lead to an array of 101 elements, having 99 elements with value "undef".

or if someone - in a list of 3 items - deletes one field in the middle of a list:

e.g.

name.0
name.1 => this one is deleted, but you'll still get an array with three elements, one being "undef"
name.2

Rails solves this by adding "[]" after the name. That way the server decides the index value, not the client.

Can this be changed, or is it already available somewhere?

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

1 participant