powmedia/backbone-forms — pull request #340 by adriano-di-giovanni (2014-01-04 11:23:28+00:00)
Title: idPrefix is always `undefined_`

`render` method of `Form.editors.NestedModel` defined `this.nestedForm` as follows:

```javascript
render: function() {
//Get the constructor for creating the nested form; i.e. the same constructor as used by the parent form
var NestedForm = this.form.constructor;

...

//Wrap the data in a model if it isn't already a model instance
var modelInstance = (data.constructor === nestedModel) ? data : new nestedModel(data);

this.nestedForm = new NestedForm({
model: modelInstance,
idPrefix: this.id + '_',
fieldTemplate: 'nestedField'
});
```

Thus, `idPrefix` attribute for `NestedForm` options hash was always `undefined_`.

I changed the line `idPrefix: this.id + ' '` to `idPrefix: modelInstance.cid` in order to have unique field ids.

I also built for distribution.

I think it is now correct. If it's not, please feel free to reject my pull request: you won't hurt my feelings :)