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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions distribution.amd/backbone-forms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Backbone Forms v0.14.0
* Backbone Forms v0.14.2
*
* NOTE:
* This version is for use with RequireJS
Expand Down Expand Up @@ -1630,7 +1630,10 @@ Form.editors.Select = Form.editors.Base.extend({
},

setValue: function(value) {
this.$el.val(value);
var
val = (value instanceof Backbone.Model) ? value.id : value;

this.$el.val(val);
},

focus: function() {
Expand Down Expand Up @@ -2056,7 +2059,7 @@ Form.editors.NestedModel = Form.editors.Object.extend({

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

Expand Down Expand Up @@ -2453,7 +2456,7 @@ Form.editors.DateTime = Form.editors.Base.extend({


//Metadata
Form.VERSION = '0.14.0';
Form.VERSION = '0.14.2';

//Exports
Backbone.Form = Form;
Expand Down
2 changes: 1 addition & 1 deletion distribution.amd/backbone-forms.min.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions distribution/backbone-forms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Backbone Forms v0.14.0
* Backbone Forms v0.14.2
*
* Copyright (c) 2013 Charles Davison, Pow Media Ltd
*
Expand Down Expand Up @@ -1643,7 +1643,10 @@ Form.editors.Select = Form.editors.Base.extend({
},

setValue: function(value) {
this.$el.val(value);
var
val = (value instanceof Backbone.Model) ? value.id : value;

this.$el.val(val);
},

focus: function() {
Expand Down Expand Up @@ -2069,7 +2072,7 @@ Form.editors.NestedModel = Form.editors.Object.extend({

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

Expand Down Expand Up @@ -2466,7 +2469,7 @@ Form.editors.DateTime = Form.editors.Base.extend({


//Metadata
Form.VERSION = '0.14.0';
Form.VERSION = '0.14.2';


//Exports
Expand Down
2 changes: 1 addition & 1 deletion distribution/backbone-forms.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": {
"name": "Charles Davison"
},
"version": "0.14.0",
"version": "0.14.2",
"dependencies": {
"backbone": ">=1.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/editors/nestedmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Form.editors.NestedModel = Form.editors.Object.extend({

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

Expand Down
5 changes: 4 additions & 1 deletion src/editors/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ Form.editors.Select = Form.editors.Base.extend({
},

setValue: function(value) {
this.$el.val(value);
var
val = (value instanceof Backbone.Model) ? value.id : value;

this.$el.val(val);
},

focus: function() {
Expand Down