How to use the backbone.Form function in backbone

To help you get started, we’ve selected a few backbone examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CartoDB / cartodb / lib / assets / javascripts / cartodb3 / editor / widgets / widgets-form / widgets-form-data-view.js View on Github external
_initViews: function () {
    if (this._widgetFormView) {
      this._widgetFormView.remove();
    }

    this._widgetFormView = new Backbone.Form({
      model: this._widgetFormModel
    });

    this._widgetFormView.bind('change', function () {
      var errors = this.commit();
      console.log('errors', errors);
    });

    this.$('.js-content').html(this._widgetFormView.render().$el);

    return this;
  },
github archivist / archivist / client / platform / views / definitions.js View on Github external
onRender: function() {
    var that = this,
        model = this.model;
    this.form = new Backbone.Form({
      model: this.model
    }).render();
    this.$el.find('.delete').on('click', function() {
      that.delete();
    });
    this.$el.find('.form').prepend(this.form.el);
    this.gridUrl = this.collection.url.split('/')[this.collection.url.split('/').length - 1];
  },
  serializeData: function () {
github CartoDB / cartodb / lib / assets / javascripts / cartodb3 / editor / style / style-form / style-aggregation-form / style-aggregation-form-view.js View on Github external
_initViews: function () {
    this._aggrFormModel = new StyleShapeFormModel(
      this._styleModel.get('aggregation'),
      {
        queryGeometryModel: this._queryGeometryModel,
        querySchemaModel: this._querySchemaModel,
        styleModel: this._styleModel,
        configModel: this._configModel,
        userModel: this._userModel,
        modals: this._modals
      }
    );

    this._aggrFormView = new Backbone.Form({
      model: this._aggrFormModel
    });

    this._aggrFormView.bind('change', function () {
      this.commit();
    });

    this.$('.js-aggregationForm').append(this._aggrFormView.render().el);
  },
github CartoDB / cartodb / lib / assets / javascripts / cartodb3 / editor / style / style-form / style-properties-form / style-labels-properties-form-view.js View on Github external
_genLabelsFormView: function () {
    this._labelsFormView = new Backbone.Form({
      className: 'Editor-formInner--nested',
      model: this._labelsFormModel
    });

    this._labelsFormView.bind('change', function () {
      this.commit();
    });

    this.$el.append(this._labelsFormView.render().el);
  },
github CartoDB / cartodb / lib / assets / javascripts / cartodb3 / components / table / editors / types / editor-date-view.js View on Github external
render: function () {
    this._formView = new Backbone.Form({
      model: this._formModel
    });

    this._formView.bind('change', function () {
      this.commit();
    });

    this.$el.html(this._formView.render().el);

    return this;
  },
github CartoDB / cartodb / lib / assets / javascripts / cartodb3 / components / date-picker-range / date-picker-range-view.js View on Github external
validators: ['required', {
          type: 'interval',
          min: min,
          max: max
        }]
      };
    };

    this.model.schema = {
      fromHour: generateNumberType(0, 23),
      fromMin: generateNumberType(0, 59),
      toHour: generateNumberType(0, 23),
      toMin: generateNumberType(0, 59)
    };

    this._datesForm = new Backbone.Form({
      model: this.model,
      template: datePickerTemplate
    });

    this._datesForm.bind('change', function () {
      this.commit();
    });
    this.$('.js-timers').append(this._datesForm.render().el);
  },
github CartoDB / cartodb / lib / assets / core / javascripts / cartodb3 / editor / widgets / widgets-form / widgets-form-fields-view.js View on Github external
_initViews: function () {
    var model = this._widgetFormModel;
    var fields = model.getFields();

    this._widgetFormView = new Backbone.Form({
      template: template,
      templateData: {
        dataFields: fields.data,
        styleFields: fields.style
      },
      model: model
    });

    this._widgetFormView.bind('change', function () {
      this.commit();
    });

    this.$el.append(this._widgetFormView.render().$el);

    return this;
  },
github CartoDB / cartodb / lib / assets / javascripts / cartodb3 / editor / layers / layer-content-views / infowindow / infowindow-form-view.js View on Github external
if (this._formView) {
      this._formView.remove();
    }

    this._formModel = new InfowindowFormModel({
      width: this._layerInfowindowModel.get('width'),
      headerColor: {
        color: {
          fixed: '#CCC'
        }
      }
    }, {
      layerInfowindowModel: this._layerInfowindowModel
    });

    this._formView = new Backbone.Form({
      model: this._formModel
    });

    this._formView.bind('change', function () {
      this.commit();
    });

    this.$('.js-form').append(this._formView.render().$el);
  },
github CartoDB / cartodb / lib / assets / core / javascripts / cartodb3 / editor / layers / edit-feature-content-views / edit-feature-attributes-form-view.js View on Github external
_generateForms: function () {
    var self = this;

    if (this._formView) {
      this._formView.remove();
    }

    this._formView = new Backbone.Form({
      model: this.model
    });

    this._formView.bind('change', function () {
      var validate = this.validate();
      self.model.trigger('validate', !!validate);

      if (!validate) {
        this.commit();
      }
    });

    this.$('.js-form').append(this._formView.render().$el);
  },
github CartoDB / cartodb / lib / assets / javascripts / builder / editor / layers / layer-content-views / analyses / analysis-form-view.js View on Github external
render: function () {
    this.clearSubViews();
    this.$el.empty();

    this._formView = new Backbone.Form({
      model: this._formModel,
      trackingClass: 'track-' + this._formModel.get('type') + '-analysis',
      template: this._formModel.getTemplate(),
      templateData: this._formModel.getTemplateData()
    });

    this._formView.bind('change', this._onChangeAnalysisFormView, this);
    this.$el.append(this._formView.render().el);

    return this;
  },