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

idPrefix is always undefined_ #340

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

adriano-di-giovanni
Copy link

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

  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 :)

@adriano-di-giovanni
Copy link
Author

I also changed version number and built again for distribution. I did it because I need to consume my fork with bower. Hope it helps.

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.

1 participant