Skip to content
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
5 changes: 5 additions & 0 deletions src/BoundField.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ BoundField.prototype.asWidget = function(kwargs) {
if (typeof attrs.key == 'undefined') {
attrs.key = name
}
if (this.form.fieldRef) {
attrs.ref = (ref) => {
this.form.fieldRef(ref, this.name, this.form)
}
}

var validation = this._getValidation(widget)

Expand Down
3 changes: 2 additions & 1 deletion src/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var Form = Concur.extend({
data: null, files: null, autoId: 'id_{name}', prefix: null,
initial: null, errorConstructor: ErrorList, labelSuffix: ':',
emptyPermitted: false, validation: null, controlled: false,
onChange: null, errors: null
onChange: null, errors: null, fieldRef: null
}, kwargs)
this.isInitialRender = (kwargs.data == null && kwargs.files == null)
this.data = kwargs.data || {}
Expand All @@ -72,6 +72,7 @@ var Form = Concur.extend({
this.emptyPermitted = kwargs.emptyPermitted
this.controlled = kwargs.controlled
this.onChange = kwargs.onChange
this.fieldRef = kwargs.fieldRef

// Auto validation is implied when onChange is passed
if (is.Function(kwargs.onChange)) {
Expand Down