ce4064f459940a4794cf1f47ec57ee76225df1cd
[ccsdk/features.git] /
1 (function( app ) {
2
3         var ux = app.ns("ux");
4
5         ux.FieldCollection = ux.Observable.extend({
6                 defaults: {
7                         fields: []      // the collection of fields
8                 },
9                 init: function() {
10                         this._super();
11                         this.fields = this.config.fields;
12                 },
13                 validate: function() {
14                         return this.fields.reduce(function(r, field) {
15                                 return r && field.validate();
16                         }, true);
17                 },
18                 getData: function(type) {
19                         return this.fields.reduce(function(r, field) {
20                                 r[field.name] = field.val(); return r;
21                         }, {});
22                 }
23         });
24
25 })( this.app );