naming convention configurable for repeatable fields?
nicolasfranck opened this issue · 0 comments
nicolasfranck commented
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?