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

* Fixed mapModel issue when input name is nested #153

Merged
merged 1 commit into from
Jul 6, 2015

Conversation

garbin
Copy link
Contributor

@garbin garbin commented Jul 1, 2015

you mentioned on #120 (comment) has bug
My code is

<input name="product" />
<input name="stock.price" />
<input name="stock.sku" />

mappedModel should be

{
   product_name:...,
   stock:{
      price: ...,
      sku: ...
   }
}

But In my situation, the mappedModel is

{
    price: ...
    sku:....
    product_name: ...
    stock:{}
}

So I created this PR to fixed it.

christianalfoni added a commit that referenced this pull request Jul 6, 2015
* Fixed mapModel issue when input name is nested
@christianalfoni christianalfoni merged commit 4279dd5 into christianalfoni:master Jul 6, 2015
@christianalfoni
Copy link
Owner

Hi @garbin , great! Thanks. Working on a new version of formsy now, going through all open issues and adding support for React 0.14, adding support for the new parent-child context relationship

@ryanblakeley
Copy link
Contributor

Is Array support not included? My use case is:

{
  foo: ['','']
}
...
name='foo[0]'
name='foo[1]'

This PR allows:

{
  foo: {
    0: '',
    1: ''
  }
}
...
name='foo.0'
name='foo.1'

@ryanblakeley
Copy link
Contributor

@garbin @christianalfoni
The inputs parameter for the handler props.mapping is not getting mapped for nested objects like this.model.

// inputs
{
  'foo.0': '',
  'foo.1': ''
}

// this.model
{
  foo: {
    0: '',
    1: ''
  }
}
Is this intentional or a bug?

@garbin
Copy link
Contributor Author

garbin commented Aug 22, 2015

I think this is a new feature that needs to be discussed.

@christianalfoni
Copy link
Owner

Hi!

Yeah, @rblakeley, please set up a new issue on that. Currently it just builds objects by splitting on .. It was implemented like this based on a discussion, but lets review it :-)

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

Successfully merging this pull request may close these issues.

3 participants