Skip to content

Commit

Permalink
Multilevel serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
soyjavi committed Aug 4, 2015
1 parent b77b525 commit b831826
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/form/index.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@ module.exports = React.createClass

getValue: ->
value = {}
value[ref] = el.getValue() for ref, el of @refs when el.getValue?
for ref, el of @refs when el.getValue?
if ref.indexOf('.') is -1
value[ref] = el.getValue()
else
parent = value
for attr, index in hierarchy = ref.split('.')
if index is hierarchy.length - 1
parent[attr] = el.getValue()
else
parent[attr] = parent[attr] or {}
parent = parent[attr]
value

setValue: (data = {}) ->
Expand Down

0 comments on commit b831826

Please sign in to comment.